# Random steps in GN

has anybody idea how to do this ? I've tried math function modulo and snap but partial effect no x position.

• Commented Oct 16, 2023 at 22:27

Assuming you start from a randomly generated curve like this one:

You can realign specific pairs of points by shifting them along X and then in Z direction in two steps. Point pairs aligned by X are (0,1), (2,3), (4,5), (6,7), (8,9), (10,11) etc. where the second in the pair takes the value of X from the first.

Point pairs aligned by Z are (0), (1,2), (3,4), (5,6), (7,8), (9,10), (11,12) etc. where the second in the pair takes the value of Z from the first (excluding point at index 0)

We can use Sample Index Node to get a value from the desired index. For that we need to create two sequences based on index numbers 1,2,3,4,5,6... in the form of:

0,0,2,2,4,4,6,6,8,8,10,10...

and

0,1,1,3,3,5,5,7,7,9,9,11,11...

The node setup and result is shown on the figure bellow:

I hope that helps.

Edit: A less geeky way to do it and amazingly simpler is to individually scale the even edges along X and all odd edges along Z (or vice versa). You will get different look, but as it is random anyway it doesn't really matter. The node set up is on the figure bellow:

• Thank You very much. You are a lifesaver Commented Oct 17, 2023 at 9:48
• You're very welcome. Commented Oct 17, 2023 at 10:32