Hi,
I'm trying to seed randomness in my scripts, using the Jscript Math.random() method.
I can't for the life of me figure out how to seed this random number generator. Some resources suggest placing a seed value in the parenthesis, but even with a constant, the returned value is always random (seeded by time?).
Any tips on how to overcome this would be greatly appreciated.
Thanks,
Ciaran Moloney
Math.floor gives better results than Math.round to create the ints
________________________________
Thanks,
Ciaran Moloney
---
Unsubscribe? Mail Majo...@Softimage.COM with the following text in body:
unsubscribe xsi
Sorry, I guess I didn't make my question clear.
You method works well for purely random numbers, but I'm looking for repeatability.
I want to use a seed so that every time I call the random function, I will get the same pseudo-random result, resulting from that seed value.
Cheers.
From: Moloney, Ciaran [mailto:cmol...@nybg.org]
Sent: November 26, 2007 12:37 PM
To: X...@Softimage.COM
Subject: Re: Seeding random number with Jscript?
Thankyou, Sir!
---------- Forwarded message ----------
From: "Halfdan Ingvarsson" <hingv...@Softimage.COM>
Date: Nov 26, 2:43 pm
Subject: Seeding random number with Jscript?
To: XSI Mailing List Archive
Here's a fairly decent one based on info fromhttp://crypto.mat.sbg.ac.at/results/karl/server/node4.html:
There is no seed function for jscript’s RNG. A good RNG is a useful thing to have in your toolbox. I’d grab Halfy’s and keep it. (fnaar).
Beware the overhead of calling commands, especially custom commands.
From: owne...@Softimage.COM [mailto:owne...@Softimage.COM] On Behalf Of Kent Bowling
Sent: 26 November 2007 19:30