oasys::ByteGenerator Class Reference

#include <Random.h>

List of all members.


Detailed Description

Generates a some what random stream of bytes given a seed.

Useful for making random data. The randomizer uses a linear congruential generator I_k = (a * I_{k-1} + c ) mod m with a = 3877, c = 29574, m = 139968. Should probably try find better numbers here.

Definition at line 66 of file Random.h.

Public Member Functions

 ByteGenerator (unsigned int seed=0)
void fill_bytes (void *buf, size_t size)
 Fill a buffer with size random bytes.

Static Public Attributes

static const unsigned int A = 1277
static const unsigned int M = 131072
static const unsigned int C = 29574

Private Member Functions

void next ()
 Calculate next random number.

Private Attributes

unsigned int cur_


Constructor & Destructor Documentation

oasys::ByteGenerator::ByteGenerator ( unsigned int  seed = 0  ) 

Definition at line 24 of file Random.cc.

References next().


Member Function Documentation

void oasys::ByteGenerator::fill_bytes ( void *  buf,
size_t  size 
)

Fill a buffer with size random bytes.

Definition at line 31 of file Random.cc.

References cur_, and next().

void oasys::ByteGenerator::next (  )  [private]

Calculate next random number.

Definition at line 42 of file Random.cc.

References A, C, cur_, and M.

Referenced by ByteGenerator(), and fill_bytes().


Member Data Documentation

const unsigned int oasys::ByteGenerator::A = 1277 [static]

Definition at line 75 of file Random.h.

Referenced by next().

const unsigned int oasys::ByteGenerator::M = 131072 [static]

Definition at line 76 of file Random.h.

Referenced by next().

const unsigned int oasys::ByteGenerator::C = 29574 [static]

Definition at line 77 of file Random.h.

Referenced by next().

unsigned int oasys::ByteGenerator::cur_ [private]

Definition at line 80 of file Random.h.

Referenced by fill_bytes(), and next().


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