Lattice Random Walk in 3D

Manipulate[Module[{rn,rnmax},{rn,rnmax}=FoldList[Plus,{0,0,0},SeedRandom[seed];RandomChoice[Flatten[{#,-#}&@Permutations[{0,0,1}],1],#]]&/@{n,max};Graphics3D[Line[rn],PlotRange->If[pr,All,({Min[#]-2,Max[#]+2}&/@Transpose[rnmax])],ImageSize->{500,350},BoxStyle->Dotted]],
{{max,10000,"maximum steps"},10^Range[2,5]},
{{n,50,"steps taken"},1,max,1,Appearance->"Labeled"},
Delimiter,
{{seed,1234,"new random walk"},1000,100000,1},{{pr,False,"shrink to fit"},{True,False}},
ControllerLinking->False]

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

Contributed by: Stephen Wolfram