Gamma  0.9.5
Generic Synthesis Library
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
RNGLinCon Struct Reference

Linear congruential uniform pseudo-random number generator. More...

#include <rnd.h>

Inheritance diagram for RNGLinCon:
RMulAdd< uint32_t > Val< uint32_t >

List of all members.

Public Member Functions

 RNGLinCon (uint32_t seed)
void type (int v)
 Change the type of equation used.
uint32_t operator[] (uint32_t i) const
 Array get; generates next element.
uint32_t & operator[] (uint32_t i)
 Array set; sets current value.
uint32_t operator() () const
 Generate next value.

Public Attributes

uint32_t mul
 Multiplication amount.
uint32_t add
 Addition amount.
uint32_t val
 Value.

Detailed Description

Linear congruential uniform pseudo-random number generator.

This generator is very fast requiring only a single integer multiply and add per iteration. However, the least significant bits of the numbers are less random; the most extreme case being the LSB which at best flips between 0 and 1. This generator also exhibits poor dimensional distribution, therefore it is best to have a different generator for each dimension, rather than sharing one.


Constructor & Destructor Documentation

RNGLinCon ( uint32_t  seed)
Parameters:
[in]seedInitial seed value

Member Function Documentation

void type ( int  v)

Change the type of equation used.

0 - Knuth, Numerical Recipes in C
1 - BCPL


The documentation for this struct was generated from the following file: