R/random.walk.R

"random.walk" <-

function(n, p = 0.5)



{



	cumsum(rbern(n, p) * 2. - 1.)



}

Try the Rlab package in your browser

Any scripts or data that you put into this service are public.

Rlab documentation built on May 5, 2022, 1:05 a.m.