We consider a physical source of entropy to be better than a simulated one, so we will try to use one (/dev/urandom on posix, for example). If a pseudo-random number generator is to be used, it should be seeded from the physical source, if possible, rather than the usual custom of seeding it from the system clock. Random number sources that are not known to be thread-safe should be polled serially. Copyright 2005 Fourthought, Inc. (USA). Detailed license and copyright information: http://4suite.org/COPYRIGHT Project home, documentation, distributions: http://4suite.org/
Functions:
|
Globals:
|
Used to instantiate instances of Random to get generators that don't share state. Especially useful for multi-threaded programs, creating a different instance of Random for each thread, and using the jumpahead() method to ensure that the generated sequences seen by each thread don't overlap. Class Random can also be subclassed if you want to use a different basic generator of your own devising: in that case, override the following methods: random(), seed(), getstate(), setstate() and jumpahead(). Optionally, implement a getrandombits() method so that randrange() can cover arbitrarily large ranges.