Make your own free website on Tripod.com

Contents Turbed: A Turbulent Behavior Development System News
In file random.hpp:

class NRand

Random number generator

Public Methods

o NRand(long s=1107)
default constructor (default value is 1107).
o NRand(NRand& n)
Copy constructor.
ovoid setSeed(long s)
Initialize seed value.
olong getSeed()
Get seed value
ofloat Random()
Generate random numbers between 0.0 and 1.0
ofloat random()
Generate random numbers between -1.0 and 1.0
ofloat randRange(float min, float max)
Generate random number between the range (min,max).
ofloat noise3(float point[3])
3D uncorrelated noise value from a 3d point
ofloat turbulence(float point[3], float lofreq, float hifreq)
perlin turbulence function
oint operator==(NRand &n)
Compare seed values
oNRand& operator=(NRand &n)
Set seed value from another randomizer
oNRand& operator=(int n)
Set seed value directly
o ~NRand()
Std. Class destructor

Private Fields

olong seed
Random number seed


Documentation

Random number generator.

Generate well behaved PseudoRand numbers and 3D noise from a given seed.

NOTE: Random() has the bad property that the first random number returned after RandomSeed() is called is proportional to the seed value! To help solve this we call RandomSeed() a few times inside seed. This doesn't ruin the repeatability of Random().


This class has no child classes.
Author:
Daniel Barrero

Alphabetic index HTML hierarchy of classes or Java


This software was originally written by Daniel Barrero at the IRIT's Equipe Synthèse d'Images
contact: barrero@irit.fr

Generated by doc++