Random Class Reference

A random number generator. More...

#include <Random.h++>

List of all members.

Public Member Functions

 Random () throw ()
 Construct a new random number generator with a default seed which is based on a combination of the current thread ID, process ID, and system time.
 Random (uint32_t seed) throw ()
 Construct a new random number generator with the given seed.
 ~Random () throw ()
 Destructor.
uint32_t nextInt (uint32_t range) throw ()
 Generate a random integer.
double nextDouble () throw ()
 Generate a random double value.
bool getBytes (byte_t *buf, size_t len) throw ()
 Fill a byte buffer with random bytes.

Detailed Description

A random number generator.

Author:
Mark Lindner

Constructor & Destructor Documentation

Random (  )  throw ()

Construct a new random number generator with a default seed which is based on a combination of the current thread ID, process ID, and system time.

Random ( uint32_t  seed  )  throw ()

Construct a new random number generator with the given seed.

~Random (  )  throw ()

Destructor.


Member Function Documentation

bool getBytes ( byte_t buf,
size_t  len 
) throw ()

Fill a byte buffer with random bytes.

Parameters:
buf The buffer to fill.
len The length of the buffer.
Returns:
true on success, false otherwise.
double nextDouble (  )  throw ()

Generate a random double value.

Returns:
A double in the range [0.0, 1.0).
uint32_t nextInt ( uint32_t  range  )  throw ()

Generate a random integer.

Parameters:
range The desired range of the value to be returned.
Returns:
An integer in the range [0, range).

The documentation for this class was generated from the following files:
Generated on Sat Nov 26 16:49:09 2011 for libcommonc++ by  doxygen 1.6.3