Skip to content

Commit

Permalink
COMMON: Remove unused RandomSource destructor, clarify comments, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed May 17, 2011
1 parent fc9b8d2 commit d165292
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
9 changes: 3 additions & 6 deletions common/random.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
8 changes: 4 additions & 4 deletions common/random.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,9 @@ class RandomSource {
*/
RandomSource(const String &name);

~RandomSource();

void setSeed(uint32 seed);

uint32 getSeed() {
uint32 getSeed() const {
return _randSeed;
}

Expand All @@ -59,12 +57,14 @@ class RandomSource {
* @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
Expand Down

0 comments on commit d165292

Please sign in to comment.