COMMON: Remove unused RandomSource destructor, clarify comments, cleanup

This commit is contained in:
Max Horn 2011-05-17 12:10:05 +02:00
parent fc9b8d2a71
commit d165292234
2 changed files with 7 additions and 10 deletions

View File

@ -33,15 +33,12 @@ RandomSource::RandomSource(const String &name) {
uint32 seed = g_system->getMillis();
setSeed(seed);
// Register this random source with the event recorder. This might
// reset the seed, so call it *after* the initial seed has been set.
// Register this random source with the event recorder. This may end
// up querying or resetting the current seed, so we must call it
// *after* the initial seed has been set.
g_eventRec.registerRandomSource(*this, name);
}
RandomSource::~RandomSource() {
// TODO: Unregister with g_eventRec
}
void RandomSource::setSeed(uint32 seed) {
_randSeed = seed;
}

View File

@ -45,11 +45,9 @@ public:
*/
RandomSource(const String &name);
~RandomSource();
void setSeed(uint32 seed);
uint32 getSeed() {
uint32 getSeed() const {
return _randSeed;
}
@ -59,12 +57,14 @@ public:
* @return a random number in the interval [0, max]
*/
uint getRandomNumber(uint max);
/**
* Generates a random bit, i.e. either 0 or 1.
* Identical to getRandomNumber(1), but faster, hopefully.
* Identical to getRandomNumber(1), but potentially faster.
* @return a random bit, either 0 or 1
*/
uint getRandomBit();
/**
* Generates a random unsigned integer in the interval [min, max].
* @param min the lower bound