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(); uint32 seed = g_system->getMillis();
setSeed(seed); setSeed(seed);
// Register this random source with the event recorder. This might // Register this random source with the event recorder. This may end
// reset the seed, so call it *after* the initial seed has been set. // up querying or resetting the current seed, so we must call it
// *after* the initial seed has been set.
g_eventRec.registerRandomSource(*this, name); g_eventRec.registerRandomSource(*this, name);
} }
RandomSource::~RandomSource() {
// TODO: Unregister with g_eventRec
}
void RandomSource::setSeed(uint32 seed) { void RandomSource::setSeed(uint32 seed) {
_randSeed = seed; _randSeed = seed;
} }

View file

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