Generating 2-D random unit steps
-
Choose a random number
in the range and
then set .
-
Choose a random value for
in the range and
(choose the sign randomly too).
-
Choose separate random values for in the range
(but not ). Normalize
so that the
step size is 1.
-
Choose a direction (N, E, S, W) randomly as the step direction
(no trigonometric functions are then needed). Note, choosing one of
four directions is equivalent to choosing a random interger on [0,3].
-
Choose separate random values
in the range .
Although the step size is generally not 1, it becomes 1 on the average.
Although all these methods seem to be reasonable, only the last one gives us good
results when we are dealing with a large number of steps.
BACK to the main document.