oasys::Random Class Reference

#include <Random.h>

List of all members.


Detailed Description

Given a seed, generate some number n such that 1 <= n <= seed.

Definition at line 28 of file Random.h.

Static Public Member Functions

static void seed (unsigned int seed)
 Seed the random number generator(s).
static int rand (unsigned int max=RAND_MAX)
 Returns a random integer in the range [0.


Member Function Documentation

static void oasys::Random::seed ( unsigned int  seed  )  [inline, static]

Seed the random number generator(s).

Definition at line 33 of file Random.h.

Referenced by oasys::UnitTester::init(), main(), and dtn::DTND::seed_random().

static int oasys::Random::rand ( unsigned int  max = RAND_MAX  )  [inline, static]

Returns a random integer in the range [0.

.max) -- this could probably be enhanced at some future time with a better random number generator.

Also, this only works well if the low order bits of rand() are just as random as the high order bits, which may or may not be the case on all systems. If that is an issue, then the implementation could be changed to use floating point arithmetic. We've biased for simplicity here until and unless we need really good random numbers (in which case rand() will be insufficient anyway).

Definition at line 51 of file Random.h.

Referenced by oasys::PermutationArray::PermutationArray(), oasys::IPClient::read(), dtn::ProphetEncounter::run(), and dtn::BluetoothDiscovery::run().


The documentation for this class was generated from the following file:
Generated on Thu Jun 7 12:54:37 2007 for DTN Reference Implementation by  doxygen 1.5.1