RE: [OpenSTA-devel] Re: When is Random not random?
Brought to you by:
dansut
|
From: Wickersham, P. <Pet...@di...> - 2006-01-06 18:50:29
|
Yup, it is in both of those files that we use srand() and rand() in the ways that I describe. I think that the seed generated by GetRandomSeed() is fine as it is based on time, which is the usual way people seed rand() for best randomness. However, the issue comes from the fact that we continually reseed every iteration.=20 In fact, there already is an issue with this code for REPEATABLE RANDOM and that is the fact that we are using rand() in the first place. This is a global function and the seed is a global, as well. So, if you want more than one REPEATABLE RANDOM sequence, this won't work. The best approach would be create a random generator class and then associate an instance with each variable that is defined to be either RANDOM or REPEATABLE RANDOM. That way each sequence can be seeded with the provided seed in the SCL, or the default (0?).=20 Here is one class that I found in a quick dig around the internet that is based on a different kind of random generator than the standard rand() functions. http://www.coyotegulch.com/products/libcoyotl/twisted_road/ -peter BTW, if I were interested in trying to implement this, am I better off grabbing the 1.4.3 source and getting it built than playing with the CVS HEAD? I'll search the archives on the devel list about building the source. I have been looking at the web page and grabbing the various 3rd party libraries, but it seems like some are unaccessible (CodeMax?). Do I need all of them to build a patch for this, or do I just need to build the CyrVDK011 DLL? -----Original Message----- From: ope...@li... [mailto:ope...@li...] On Behalf Of Mark Elam Sent: Friday, January 06, 2006 12:21 AM To: ope...@li... Subject: Re: [OpenSTA-devel] Re: When is Random not random? Daniel Sutcliffe wrote: > Peter Wickersham wrote: >>So, I looked at the source and the code appears to use srand() >>everytime it calls rand() with the last result from calling rand(). >>However, this actually ends up producing more collisions more >>quickly than just calling srand() once.=20 >=20 >=20 > Can you give us a source file and line number to save me a little bit > of work? I'm only just getting into the inner workings of SCL - the > previous SCL internals expert no longer has time to give to this=20 > project. >=20 This will be the variable handling at runtime, in both CECRangeVar.cpp=20 and CECListVar.cpp. The seed generated at the start of the variable use=20 should bring in a semi random element (see comments in=20 CECVar::GetRandomSeed()). Obviously not enough :-) Can't remember if the options passed at variable contruction will allow a runtime descision as to if this is REPEATABLE RANDOM or not though. Can probably have a look=20 later if no one else gets a chance. Mark ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick _______________________________________________ OpenSTA-devel mailing list Ope...@li... https://lists.sourceforge.net/lists/listinfo/opensta-devel |