Lattice Random Walk in 2D

Manipulate[Module[{rn,rnmax},{rn,rnmax}=FoldList[Plus,{0,0},SeedRandom[seed];RandomChoice[{{0,1},{1,0},{0,-1},{-1,0}},#]]&/@{n,max};Graphics[If[arrows,{Arrowheads[0.5/(Max[rnmax]-Min[rnmax])],Arrow/@Partition[rn,2,1]},Line[rn]],ImageSize->{500,325},PlotRange->If[pr,All,{{-Sqrt[max],Sqrt[max]},{-Sqrt[max],Sqrt[max]}}]]],
{{max,10000,"maximum steps"},10^Range[2,5]},
{{n,50,"steps taken"},1,max,1},Delimiter,
{{seed,1234,"new random walk"},1000,100000,1},
{{arrows,False,"show arrows"},{True,False}},{{pr,False,"shrink to fit"},{True,False}}]

At each step, the walk goes randomly a unit distance along one of the four possible 2D coordinate directions.

Contributed by: Stephen Wolfram