This is more of a comment on what is wrong with the code than an answer; the links in the comments point to-pretty much-authoritative implementations.
Looking at how Walk is implemented, it makes sense to evaluate something like Walk[100]-even though there are some minor tweaks in the code that will be proposed later in this note-but evaluating Walk[x^2 + y^2 <= 50 || -10 <= x <= 10 && 4 <= y <= 10, x, y, 1, 11] stops making sense from the first argument.
With the already provided implementation of Walk, argument 1 is expected to be a number whereas in the later evaluation it is an expression involving inequalities. Also, the initial implementation does not account for other arguments. Taking a guess, x,y are presumably the relevant variables in the expression involving inequalities; the rest of the input ie 1,11 is not to easy to understand. Without any explicit explanation, it is a matter or interpretation.
In what follows I will present a version of Walk that can accommodate inequalities:
(* requires a seed for reproducibility of random output *)
walk[r_, vars_?ListQ, seed_: 123456789] := Module[{reg, path, rands, rng},
(* obtain the region *)
reg = Reduce[r, vars, Reals];
(* make reproducible *)
BlockRandom[
(* random steps in the unit ball *)
rands := RandomReal[{-1, 1}, 2];
path = NestWhileList[
(* produce the *next* random point... *)
# + rands &,
(* begin from the origin... *)
{0., 0.},
(* while the *current* point is within the region... *)
reg /. Thread[vars -> #] &
], RandomSeeding -> seed];
(* correct for the last point outside the region *)
path = Most@path;
(* range for RegionPlot *)
rng = Sequence @@ MapIndexed[
{vars[[#2[[-1]]]], Sequence @@ #1} &,
Through[{Min, Max}[#]] & /@ Transpose[path]
];
(* output *)
Show[
{
RegionPlot[reg, Evaluate@rng],
ListPlot[path,
PlotStyle -> {Red, PointSize[Small]}
]
},
PlotLabel -> Row[{"seed=", , seed}],
Epilog -> {
(* light blue point designates the starting point *)
{Lighter@Blue, PointSize[Large], Point[First@path]},
{Red, Opacity[0.4], Line[path]}
}
]
]
Evaluating
BlockRandom[
walk[x^2 + y^2 <= 50 || -10 <= x <= 10 && 4 <= y <= 10, {x, y}, #] & /@ RandomInteger[{10^3, 10^7}, 5],
RandomSeeding -> 321456987
] // Partition[#, 3, 3, {1, 1}, {}] & // Grid
produces

Following is the update of the original version of Walk:
(* again, use a seed for reproducibility *)
walk[r_, seed_: 123456789] := Module[{path},
(* make reproducible *)
BlockRandom[
path = Most@NestWhile[
(* produce next step *)
# + RandomReal[{-1, 1}, 2]} &,
(* start from the origin *)
{0., 0.},
(* check if current step is valid *)
And @@ Thread[-r < #[[-1]] < r] &
], RandomSeeding -> seed
];
(* assemble output *)
Show[
{
RegionPlot[True, {s, -r, r}, {t, -r, r}],
ListPlot[path, PlotStyle -> {Red, PointSize[Small]}]
},
PlotLabel -> Row[{"seed=", , seed}],
Epilog -> {
(* use a blue point to depict the origin *)
{Lighter@Blue, PointSize[Large], Point[First@path]},
{Red, Opacity[0.4], Line[path]}
}
]
]
Evaluating
BlockRandom[
walk[10, #] & /@ RandomInteger[{10^3, 10^7}, 5],
RandomSeeding -> 456789123
] // Partition[#, 3, 3, {1, 1}, {}] & // Grid
produces

r: inWhile[-r <= x <= r && -r <= y <= r,rshould be values, but instead you usex^2 + y^2 <= 50 || -10 <= x <= 10 && 4 <= y <= 10, which does not make sense. – anderstood Mar 30 '18 at 23:51ImplicitRegionfor instance). – anderstood Mar 30 '18 at 23:55