Consider the first $10000$ digits of $\sqrt{2}$ and present them as a “random walk” by converting them in base 4 representing 4 directions. Following code produces this random walk
Manipulate[x = N[Sqrt[2], n];
walk = First@RealDigits[x, 4];
rn = FoldList[Plus, {0, 0}, {{0, 1}, {1, 0}, {0, -1}, {-1, 0}}[[# + 1]] & /@ walk];
Graphics[{Line[rn], PointSize[Large], Green, Point[First@rn], Red,
Point[Last@rn]}], {n, 1, 10000, 1}]
I want to do same manipulation for random integers (from $1$ to $ 4$).
I tried:
Manipulate[
rn = Accumulate[{{1, 0}, {-1, 0}, {0, 1}, {0, -1}}[[RandomInteger[{1, 4},n]]]];
Graphics[{Line[rn], PointSize[Large], Green, Point[First@rn], Red,
Point[Last@rn]}], {n, 1, 10000, 1}]
But there is no fixed "Green" dot (initial point) in the graphic.