change the code fully support user action and random action
add function in offline model