# BasicRandomNumberGenerator Class Reference

A C++ interface to system random number generators. More...

`#include <BasicRandomNumberGenerator.h>`

Collaboration diagram for BasicRandomNumberGenerator:

[legend]
List of all members.

## Public Member Functions

| BasicRandomNumberGenerator ()
void | setSeed (const unsigned int seed)
| Set the random seed.
unsigned int | getSeed ()
bool | getBool ()
| Returns one bit from the random buffer.
long | getInteger (const long min=0, const long max=RAND_MAX)
double | getRatio ()

## Static Public Member Functions

BasicRandomNumberGenerator * | getInstance ()
| Get a pointer to an instance of BasicRandomNumberGenerator.

## Protected Member Functions

virtual | ~BasicRandomNumberGenerator ()

## Private Attributes

unsigned int | seed
int | bitBuf
unsigned int | bits

## Static Private Attributes

BasicRandomNumberGenerator * | singleton = NULL

## Detailed Description

A C++ interface to system random number generators.

## Constructor & Destructor Documentation

BasicRandomNumberGenerator::BasicRandomNumberGenerator | ( |  | ) | `[inline]`

virtual BasicRandomNumberGenerator::~BasicRandomNumberGenerator | ( |  | ) | `[inline, protected, virtual]`

## Member Function Documentation

bool BasicRandomNumberGenerator::getBool | ( |  | ) |

Returns one bit from the random buffer.

Returns:
  A random boolean value.

BasicRandomNumberGenerator * BasicRandomNumberGenerator::getInstance | ( |  | ) | `[static]`

Get a pointer to an instance of BasicRandomNumberGenerator.

Creates an instance of the default implementation.

Returns:
  A pointer to an instance of BasicRandomNumberGenerator.

long BasicRandomNumberGenerator::getInteger | ( | const long | min = `0`,
|  | const long | max = `RAND_MAX`
| ) |

Parameters:

  | min | Minimum value inclusive.
  | max | Maximum value inclusive.

Returns:
  A random integer in the range [min, max].

double BasicRandomNumberGenerator::getRatio | ( |  | ) |

Returns:
  A random double in the range [0, 1).

unsigned int BasicRandomNumberGenerator::getSeed | ( |  | ) | `[inline]`

Returns:
  The seed used to initialize this sequence of random numbers.

void BasicRandomNumberGenerator::setSeed | ( | const unsigned int | seed | ) |

| Set the random seed. Using the same seed will generate the same sequence of random numbers.

## Member Data Documentation

int BasicRandomNumberGenerator::bitBuf `[private]`

unsigned int BasicRandomNumberGenerator::bits `[private]`

unsigned int BasicRandomNumberGenerator::seed `[private]`

BasicRandomNumberGenerator * BasicRandomNumberGenerator::singleton = NULL`[static, private]`

The documentation for this class was generated from the following files:

- BasicRandomNumberGenerator.h
- BasicRandomNumberGenerator.cpp