#include <Random.h>
Public Member Functions | |
| Random () | |
| ~Random () | |
| void | SetSeed (long seed) |
| void | RandomizeSeed () |
| int | GetRandMax () |
| returns the highest random integer this class can generate | |
| int | GetInt () |
| Gives a rondom number in the range [0,GetRandMax()). | |
| int | GetInt (int upperBound) |
| Gives a random integer in range [0,i). | |
| double | GetDouble () |
| returns a double in the range [0.0,1.0); there are 2^53 distinct values in this range | |
| std::set< int > | RandomUniqueNumbers (int count, int upperBound) |
| get 'count' numbers in the range [0,upperBound) | |
| int | operator() (int upperBound) |
| This function operator makes the class usable with STL algorithms. | |
Static Public Member Functions | |
| static Random & | GetGlobal () |
Private Member Functions | |
| Int64 | Next (int bits) |
Private Attributes | |
| Int64 | mSeed |
| ILOG_CLASS | |
Static Private Attributes | |
| static const int | cRandomIntBits = 31 |
Each instance has it's own state and thus a independant sequence of number. Although instances with the same state (same seed) produce the exact same sequence.
The implementation is copied from the javadoc of java.util.Random: http://java.sun.com/j2se/1.4.2/docs/api/java/util/Random.html
Implementation rationale: I initially looked for a C/C++ library, but after Dennis decided not to use boost, this seemed to be the simplest solution.
Definition at line 28 of file Random.h.
1.5.1