RiRandom

Encapsulates Random Numbers

[ Math | Source | Search | Keywords | Summary | Ancestors | All Members | Descendants ]

Quick Index

DESCRIPTION
METHOD
WARNING

Class Summary

class RiRandom
{
public:
enum Method ;
// Constructors and assignment
RiRandom(long seed , Method meth );
RiRandom(const RiRandom &);
const RiRandom &operator=(const RiRandom &);
~RiRandom();
// Accessors
void SetSeed(int seed );
RiReal operator()();
RiReal operator()(RiReal min, RiReal max);
protected:
}; // RiRandom


DESCRIPTION


METHOD

METHOD: DRand48 Drand48 is a Wrapper around drand48. Keeps state so each RiRandom is an independent stream. METHOD: NonRandom NonRandom returns .5 always. Good for testing, makes the sampling code orthogonal to the random number code.

WARNING

Passing by value creates a copy which forks off the random stream, Repeated copies from the same base will give the same sequence. Passing by reference is much more efficient, and will keep things random.


enum Method ;

Method {DRand48, NonRandom, Shuffle};No documentation available.

    enum Method {DRand48, NonRandom, Shuffle};

RiRandom(long seed , Method meth );

Default Constructor

    RiRandom(long seed = 0, Method meth = DRand48);

RiRandom(const RiRandom &);

Copy Constructor

    RiRandom(const RiRandom &);

const RiRandom &operator=(const RiRandom &);

Assignment

    const RiRandom &operator=(const RiRandom &);

~RiRandom();

Destructor

    ~RiRandom();

void SetSeed(int seed );

Set the seed in the generator

    void   SetSeed(int seed = 0);

RiReal operator()();

Return a random number in [0,1)

    RiReal operator()();

RiReal operator()(RiReal min, RiReal max);

Return a random number in [min,max)

    RiReal operator()(RiReal min, RiReal max);

All Members

public:
enum Method ;
// Constructors and assignment
const RiRandom &operator=(const RiRandom &);
// Accessors
void SetSeed(int seed );
RiReal operator()();
RiReal operator()(RiReal min, RiReal max);
protected:

Ancestors

Class does not inherit from any other class.


Descendants

Class is not inherited by any others.


Generated from source by the Cocoon utilities on Fri Feb 25 15:15:35 2000 .