# Random Walk go only one direction?

Hi Everyone,
I need and advise for my practice. i try to make " random walk " algorithm. for create point and make polyline.

1. i create random 0 1 2 3 to select Direction(+x,+y,-x,-y) from Sift Pattern
2. use Anemone Loop to add next location

But result it go only one Direction in every Seed. ???

random_walk_loop_06.gh (21.4 KB)

This is a simplified version but demonstrates a similar bias, which appears to be caused by the Random integers being grouped in the middle of the range (white group), instead of evenly distributed. Disturbing indeed.

random_walk_loop_2019Jul22a.gh (26.2 KB)

1 Like

Check this as well. a little different version.

random_walk_loop_06_re.gh (25.1 KB)

1 Like

Hi @rawee,

Hereâ€™s a solution with a little Python spice to guaranty randomness every single time:

#### Test 4:

random_walk_loop_06_2.gh (16.6 KB)

2 Likes

Fixed in cyan group using Series, Repeat and Jitter:

random_walk_loop_2019Jul22b.gh (28.1 KB)

1 Like

wow amazing! Thank you everyone.
one thing i donâ€™t need to do â€śSift patternâ€ť . Just â€śList itemâ€ť .

1 Like

I donâ€™t recall ever using Sift beforeâ€¦ This one adds random lengths (blue group):

random_walk_loop_2019Jul22c.gh (27.1 KB)

2 Likes

This probably be a slightly improved algorithm by excluding the reverse direction of the previous step direction from the next step with, choosing only one of the three directions will yield better(?)results.

RandomWalker_V2_re.gh (19.9 KB)

1 Like