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.
IndexProgramming Questions & HelpSyntax Questions › Limit randomSeed Scope
Page Index Toggle Pages: 1
Limit randomSeed Scope (Read 324 times)
Limit randomSeed Scope
Feb 14th, 2009, 9:45am
 
Sometimes i want to use randomSeed but not on all of the randoms i use in my code. For example, if i want to use it only for the color to be the same, but the movement should still be different everytime i run it... How do you solve that problem?
Re: Limit randomSeed Scope
Reply #1 - Feb 14th, 2009, 9:57am
 
I fear that this seed is global.
A solution is to have two (or more!) independent random number generators (RNG).
Note we have that already (more or less) with noise and random.
Otherwise, a well known good RNG is Mersenne Twister, which has a number of implementations in Java.
There are simpler RNGs, too... Smiley
Page Index Toggle Pages: 1