Undertaker
June 16, 2003 10:21:19
Hi,
I'm looking for a way to constrain the result fo a random value for example between 2.5 and 5.
By the way is there an other expression to generate random values instead of “rand” ?
Thanks in advance. 8)
Julien
JColdrick
June 16, 2003 11:10:42
Yup - you actually *want* to have functions like rand() to be normalized like that - helps you keep things in a nice 0-1 range until you're ready to rescale it to a new domain. The “fit” function will do this for you.
Anyway - an expression that you can use to put a random number with a seed of “$foo” ranging from 2.5 to 5 is
fit(rand($foo), 0, 1, 2.5, 5)
Cheers,
J.C.