I sketched this up very quicklysuggest using Mod
- so alla natural thing for looped boundary conditions on a torus.
Finite torus surface area is subject to checkyour bounded region.
2D random walk generally is simple:
walk = Accumulate[RandomReal[{-.1, .1}, {100, 2}]];
Graphics[Line[walk], Frame -> True]
Confinement to square region {{0,1},{0,1}} would be simple in principle with Mod[walk,1]
(periodic boundary conditions) but visualizing will be hard:
Graphics[Line[Mod[walk, 1]], Frame -> True]
So I think logical, for periodic boundary conditions, to place it on a torus ( with arbitrary radiuses ):
map[φ_, θ_] = CoordinateTransformData["Toroidal" -> "Cartesian",
"Mapping", {r, θ, φ}] /. {\[FormalA] -> 1, r -> 2 Log[2]}
walk = Accumulate[RandomReal[{-.1, .1}, {10^4, 2}]];
Graphics3D[{Opacity[.5], Line[map @@@ walk]}, SphericalRegion -> True]