algorithmic modeling for Rhino
Hello,
I am trying to use a random component to generate a list of random numbers within a certain range. Its working fine but only when I manually type in how many random numbers I want into the "N" input. But when I plug in a list length from a component earlier in the script (which defines how many random numbers I need) the random component still outputs the correct amount of random numbers but they are all the same number. Im sure im overlooking something simple, please help!
Tags:
Hi Joe,
there are no real random numbers in GH. What you get is pseudo-random numbers. A series of pseudo-random numbers is always the same for the same seed value. If you want to generate different sequences, you'll have to provide a different seed for each sequence.
A seed value is just an integer (any integer). You can generate these seeds using a [Series] component, or maybe another Random component. Do note that the random generator in Grasshopper is not a particularly good one. If you pick similar seeds, the resulting random sequences will have a high degree of relatedness. You can sort of get around this by generating very different seeds.
--
David Rutten
david@mcneel.com
Seattle, WA
Also make sure that the input to your list length component is flattened - otherwise you will get the same sequence (or number) over and over again as you're describing.
Welcome to
Grasshopper
© 2025 Created by Scott Davidson.
Powered by