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. ???

please see attachment

Thank you in advance

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 1:

example_01

Test 2:

example_2

Test 3:

example_3

Test 4:

example4

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.
:slight_smile: one thing i don’t need to do “Sift pattern” . Just “List item” . :stuck_out_tongue: :blush:

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