![](/language/gallery/img/cloud-icon.png)
Plot a Random Walk
Make a plot of a random walk. This example appears in Stephen Wolfram’s video Introduction to the Wolfram Language.
![](img/plot-a-random-walk-outputsample-1.png.en)
code
ListLinePlot[Accumulate[RandomReal[{-1, 1}, 1000]]]
how it works
RandomReal[{-1,1},1000] gives a list of 1000 random numbers uniformly distributed between -1 and 1, Accumulate gives the successive accumulated totals of the random numbers, and ListLinePlot plots the resulting list of values with a line.
ListLinePlot[Accumulate[RandomReal[{-1, 1}, 1000]]]