Grasshopper

algorithmic modeling for Rhino

hi All,

To avoid accidental patterns cropping up in my wonderful creations :), is there a way to insert the current clock time into a random seed? or is there a better way of achieving more random number sequences in a VB script component?

 

 

Views: 1928

Replies to This Discussion

Not elegant (there's certainly an easier way to format this, you might explore the System.DateTime.Now space a bit more) but it works:

A = Format(System.DateTime.Now.Hour, "00") & Format(System.DateTime.Now.Minute, "00") & Format(System.DateTime.Now.Second, "00")

There will always be an underlying pattern to a list of random numbers. Deterministic computers cannot create truly random numbers. There are better pseudo-random generator algorithms out there though than the one shipped with the .NET framework.

Another approach would be to use a random number table and import it as data. You can then either use this table directly or use it as a starting point for a random number series.

I have found that it is very important to be able to generate the same random numbers upon request, so using a varying seed is probably not a good idea.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service