[OpenSTA-devel] Re: When is Random not random?
Brought to you by:
dansut
|
From: Daniel S. <da...@Op...> - 2006-01-16 02:12:50
|
Peter Wickersham wrote: > Ok, so now that I can build, I have added a random number generator > class based on the Mersenne Twister PRNG. It is fast, uniform, and > has a long period (iterations before repeating). That's great! Can't wait to give it a go ... > However, I have run into issues in actually getting the seed from > the script set in the code. I reviewed the current code in > CECRangeVar and CECListVar and it looked like those classes were > always ignoring the seed and just using a random one to start. So, > I decided to test this, but I can't seem to get any SEED I set in > the script to actually get passed into the constuctors for these > variable classes. They always get 0, which is the default higher > in the stack if no seed is specified. Nice, I can't believe this one has never been reported before. I've verified and reported this, it's now bug# 1406872: http://sourceforge.net/tracker/index.php?func=detail&aid=1406872&group_id=10857&atid=110857 I'm sure you've also seen I've also logged the fact that RANDOMs are not uniformly distributed. This is bug# 1406888: http://sourceforge.net/tracker/index.php?func=detail&aid=1406888&group_id=10857&atid=110857 I'm not going to log the fact there is a small possibility of repeatable breaking because of threading and the non-atomicity of srand(),rand() in the current implementation. I didn't log because reproducing wouldn't ever be easy and I'm sure that whatever code replaces this will bear this possibility in mind, and avoid it ... ;-) > Does anyone know the SCL parsing/compilation pieces enough to help > me track down where the SEED seems to get lost. I just tried out Mark's 1 line fix and tested out the results - seems to totally fix the problem, which makes sense ... looks like it was just an oversight somewhere down the line, the runtime looks for "seed" in the TOF and the SCL compiler creates this qualifier as an "ivalue". Once I've got my build environments straight, re: STLport, PSDK, etc. then I'll commit this into the CVS HEAD. Hoping this will be tomorrow... Cheers /dan -- Daniel Sutcliffe <Da...@Op...> OpenSTA part-time caretaker - http://OpenSTA.org/ |