STK++ 1.0
MersenneTwister.h File Reference
#include <iostream>
#include <limits.h>
#include <stdio.h>
#include <time.h>
#include <math.h>
#include "STK_Const_Math.h"
Include dependency graph for MersenneTwister.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  MTRand
 Generate unsigner 32 bits random number using the Merdsenne Twister Algorithm. More...

Functions

std::ostream & operator<< (std::ostream &os, const MTRand &mtrand)
std::istream & operator>> (std::istream &is, MTRand &mtrand)

Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const MTRand mtrand 
) [inline]

Definition at line 383 of file MersenneTwister.h.

References MTRand::left, MTRand::N, and MTRand::state.

{
    register const MTRand::uint32 *s = mtrand.state;
    register int i = mtrand.N;
    for( ; i--; os << *s++ << "\t" ) {}
    return os << mtrand.left;
}
std::istream& operator>> ( std::istream &  is,
MTRand mtrand 
) [inline]

Definition at line 392 of file MersenneTwister.h.

References MTRand::left, MTRand::N, MTRand::pNext, and MTRand::state.

{
    register MTRand::uint32 *s = mtrand.state;
    register int i = mtrand.N;
    for( ; i--; is >> *s++ ) {}
    is >> mtrand.left;
    mtrand.pNext = &mtrand.state[mtrand.N-mtrand.left];
    return is;
}