A random walk
A random walk is a set of random numbers each added to the previous value based on some mathermatical formula.
The random numbers generated exist on the range [0, 1] and each is sequentially added to the the previous value using the formula below:
x[n] = x[n-1] + (Math.Random() * stretch)
The stretch value acts a a growth rate, by increasing stretch the chart will increase at a steeper average rate. If stretch = 1, then there is no stretching effect. If stretch = 0, the value does not change. If stretch is negative, the chart decreases.
Try increasing the value and re-computing the data set to observe its effects.
The process is extremely fast to compute, so the user can easily increase the number of iterations to tens of thousands. Try it and see what happens.
Start value | |
stretch factor | |
Number if iterations |
This is the final value (3dp):
end of walk number
This is the chart:
click compute button to generate a new dataset and chart.This is the walk array:
array of values
As usual, if you have any questions, please feel free to contact LEM solutions via the contact form or email or twitter.