Grasshopper

algorithmic modeling for Rhino

Hello Everyone!

I´m trying to generate a list of a certain length (x) of numbers placed in a random position coming from a list of 5 numbers that i have already selected.

ex. my numbers are (0, 1, 5, 8)

=> new list should be something like (1, 8, 5, 0, 1, 8, 5, 1, 0, 0....... etc.) for a total of (x) times.

Any suggestions?

Thanks a lot!

Views: 6336

Replies to This Discussion

Replace the (A,B,C,D...) list with any list of data

Attachments:

You can use Duplicate to turn your list of original numbers into the correct length, and then Jitter to randomize the order.

Or you can use the Random component to generate x random integers from 0 to N (where N is the highest index of your original list), and then use those random integers with List Item.

I'm sure there's other ways, but those two spring to mind first.

Or you can use the Random component to generate x random integers from 0 to N (where N is the highest index of your original list), and then use those random integers with List Item.

I have shown a variation of this method.

What if i want to control the distribution so that i can favor a value, for example so that the number 1 appears more often in my list.is that possible?

The top laziest way would be to use heteroptera's "cheater dice" component...

You 'd enter the list of number to pick from, and a "chance of selection" list !

oh thats great, i had no idea this component existed!

David Rutten solved this one with grasshopper components, here is the link if you are curious :

https://discourse.mcneel.com/t/random-selection-weighted-distributi...

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service