- Main Page
- Namespaces
- Classes
- Files
- Related Pages

- Class List
- Class Hierarchy
- Class Members

# col::FibRand Class Reference

Lagged Fibonacci random sequence. More...

Collaboration diagram for col::FibRand:

[legend]
List of all members.

## Random numbers
| FibRand (int seed)
unsigned int | rand (void)
| Returns a pseudo random integer in the range [0,FibRand::M_MaxRand).
unsigned int | mrand (unsigned int m)
| Returns a pseudo random integer in the range [0,m).
float | frand (void)
| Returns a pseudo random float in the range [0,1).
## Static Public Attributes
static const int | M_MaxRand = (1 << 30)
| Maximum random number plus 1 that can be returned by FibRand.

## Detailed Description

Lagged Fibonacci random sequence.

The constructor creates an object, from which you can retrieve random numbers by any of the functions FibRand::rand(), FibRand::mrand(), and FibRand::frand(). fills a field of 100 random numbers, which can be retrieved

Bug:
  The range has not really been checked/verified.

Implementation:
  Nach Knuth TAOCP Vol.2 pp.186f. Internally, a FibRand object stores 100 random numbers, which are then doled out by one of the "getters". After that, a new set of 100 numbers is generated. Hoefully, this yields better performance than producing each random number on demand.

## Member Function Documentation

unsigned int col::FibRand::rand | ( | void |  | ) |

Returns a pseudo random integer in the range [0,FibRand::M_MaxRand).

See also:
  FibRand

unsigned int col::FibRand::mrand | ( | unsigned int | m | ) |

Returns a pseudo random integer in the range [0,m).

See also:
  FibRand

float col::FibRand::frand | ( | void |  | ) |

Returns a pseudo random float in the range [0,1).

See also:
  FibRand

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

- ColUtils.h
- ColUtils.cpp