I am trying to make a random walk simulation with Animate
, but somehow it doesn't produce the animation I want.
SingleRandomWalk[k_] := Module[
{pts = {{0, 0}}},
Do[AppendTo[
pts, {0,
pts[[i, 2]] + RandomVariate[NormalDistribution[0, 1/k]]}], {i, 1,
k}];
Print[pts];
Animate[
Graphics[{PointSize[0.03], Point[pts[[i]]]}, Axes -> True,
AspectRatio -> 2, PlotRange -> {{-1, 1}, {-2, 2}}], {i, 1, k+1},
DefaultDuration -> 1]]
SingleRandomWalk[5]
Where is the problem?