We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProcessing DevelopmentLibraries,  Tool Development › Random number generator: Mersenne Twister
Page Index Toggle Pages: 1
Random number generator: Mersenne Twister (Read 994 times)
Random number generator: Mersenne Twister
May 16th, 2006, 11:41am
 
I've been using a Java implementation of the Mersenne Twister pseudorandom number generator for many years now. It's superior to java.util.Random, which is used by Processing. It creates better random numbers and can be used to create consistent random number series on different computers and VMs, which is useful for rendering on multiple computers etc.

I have packaged it up and posted it as a library for Processing here:
mw_randomMT.

I also posted it as a processinghack. Hope it might be useful to someone.
Re: Random number generator: Mersenne Twister
Reply #1 - May 16th, 2006, 4:32pm
 
shouldn't millis() be changed to System.currentTimeMillis()?
millis() only gets the number of milliseconds passed since the start of the application, which means your seed is allways (or usually) 0.

Code:

println(millis()); // outputs 0
println(System.currentTimeMillis()); // outputs 1.1477899E12


other than that, thanks for sharing Smiley

-seltar
Re: Random number generator: Mersenne Twister
Reply #2 - May 16th, 2006, 6:02pm
 
Good point, forgot that millis() is not the same as System.currentTimeMillis()...
Page Index Toggle Pages: 1