How to connect 2 points via random number

Hello! Please watch my screenshot


I have 4 points on the top view. I placed these points using Point tool in Rhino. Then I added this points to Grasshopper (Set One Point from context menu).

For example I have random number 3. It means Grasshopper should draw a line from point 4 to point 3.
If I have random number 1 Grasshopper should draw a line from point 4 to point 1.
If I have random number 2 Grasshopper should draw a line from point 4 to point 2.

I have simple random number generator


As you can see I have now random number 2. This number can be changed depending on the Seed.

How to automaticallly connect point 4 with one of three points depending on the current random number?

Hello you could use List Item to access a list of points. For that use Merge and no need of round just right click on Random and choose integer

Read some good tutorial, it will helps you

1 Like

Thanks. I’m trying to solve this exercise


It’s a fractal triangle (Sierpinski triangle)
I have simple first hand-made interation. I can not understand how to loop next interations
Please watch my definition
fractal.gh (7.8 KB)
Thanks

You cannot create that sort of loop in vanilla Grasshopper, as each iteration depends on the previous. You either need to write a loop in some scripting language, or use a plug-in like Anemone or HoopSnake to set it up.

Here’s a C# script. You may want to remove the first N points from the result as they are not anywhere near the fractal. Technically no points are exactly on the fractal, but they do get closer and closer.

RandomSierpinsky.gh (5.1 KB)

3 Likes

Thanks David!
I have no more questions

Quite interesting to see the result. (only 1000 iterations with anemone)


ChaosGame_re.gh (11.2 KB)

3 Likes

Thanks for the link, it was interesting to discover that.
It works in 3D, here volumized with Dendro plugin

3 Likes

Laurent do you still happen to have the definition? If so, could you please share it? It would be really useful to see how you used Dendro to volumize the geometry. Thanks.

Hello, no on my PC now,
there absolutely no tricks just add a point with a z, then generate half a million points then use points as entry of Dendro. That’s all.