# Random Rectangle from List of points

#1

Hey guys, Im playing around with my definition a while now, but I just cant wrap my head around this issue.

I want to connect 4 random points of a List into a rectangle.

(every colour stands for another random outcome through a seeder slider)

my definition only works for the specific seed. When altering the Seed, it sometimes uses only 3 points or connect the points in a “false” order. most likely my approach have major issues and lacks of knowing how to sort and refine the lists probably.

I hope you can help me with that newbish question.

random_rectangle.gh (8.0 KB)

#2

Hi,
not sure if it is what you want.

(David Rutten) #3

\{4, 4, 4, 4\} is a perfectly acceptable random sequence. There is no guarantee that all numbers in the range will occur before you start seeing the same number again. If you get the same number twice your quad will degenerate into a triangle. The odds of any number occurring in a random sequence is \frac{1}{R} with R being the length of the range (12 in your case). So once the first number is picked, the odds that the second number will be the same as the first are \frac{1}{12}. When you pick a third number, the odds that it will be the same as either the first or the second are \frac{2}{12}. Pick a fourth and the odds of any collision are \frac{1}{12} + \frac{2}{12} + \frac{3}{12} = \frac{6}{12} = \frac{1}{2}.

ho, dinner is served, I’ll continue this in a bit.

#4

Your Method works pretty well @Baris, thx for that. Also so small and clear compared to what I came up with.

Also I see your Point @DavidRutten and that explains the triangle degeneration pretty good to me (should have paid more attention in stochastics ) . So I’d need to extract picked variables and subtract them from the List feeding the random component? That would be a kind of feedbackloop then right? How I’d do that or is there a workaround?