RandomSource Class Reference

objects of this class are used as a source of random (non reproduceable) data

`#include <RandomSource.h>`

## Public Member Functions

| RandomSource (void)
| ~RandomSource (void)
BYTE | getByte (void)
std::vector< BYTE > | getBytes (unsigned int n)
BitString | getBits (unsigned int n)
bool | getBool (void)
unsigned long | getValue (unsigned long n)

## Private Attributes

unsigned int | RandomBytePos
BYTE | RandomByte
FILE * | RandomInput

## Constructor & Destructor Documentation

## RandomSource()

RandomSource::RandomSource | ( | void |  | ) |

## ~RandomSource()

RandomSource::~RandomSource | ( | void |  | ) |

## Member Function Documentation

## getBits()

BitString RandomSource::getBits | ( | unsigned int | n | ) |

get n random bits

Parameters

  n | the number of requested random bits

Returns
  a BitString containing n random bits

## getBool()

bool RandomSource::getBool | ( | void |  | ) |

get a boolean value

Returns
  true of false with equal probability

## getByte()

BYTE RandomSource::getByte | ( | void |  | ) |

get a random byte

Returns
  a random byte

## getBytes()

std::vector< BYTE > RandomSource::getBytes | ( | unsigned int | n | ) |

get n random bytes

Parameters

  n | the number of requested random bytes

Returns
  n random bytes

## getValue()

unsigned long RandomSource::getValue | ( | unsigned long | n | ) |

get a random value

Parameters

  n | the range of the random value to be returned

Returns
  a random number in {0,...,n-1}

## Member Data Documentation

## RandomByte

BYTE RandomSource::RandomByte

private

## RandomBytePos

unsigned int RandomSource::RandomBytePos

private

## RandomInput

FILE* RandomSource::RandomInput

private

determines the random input - is either opened file pointer to /dev/urandom or NULL (the rand() function is then used as random source)

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

- RandomSource.h
- RandomSource.cc