rw_model function

Random walk model