ViSP  2.9.0
vpGaussRand Class Reference

#include <vpNoise.h>

+ Inheritance diagram for vpGaussRand:

Public Member Functions

 vpGaussRand ()
 
 vpGaussRand (const double sigma_val, const double mean_val, const long noise_seed=0)
 
void setSigmaMean (const double sigma_val, const double mean_val)
 
void seed (const long seed_val)
 
double operator() ()
 

Protected Member Functions

double draw1 ()
 

Protected Attributes

long x
 

Detailed Description

Class for generating random number with normal probability density.

The algorithms and notations used are described in "Random Number Generation and Monte Carlo Methods", James E. Gentle, Springer 1998

The code below shows how to use the random generator.

#include <iostream>
#include <visp/vpNoise.h>
int main()
{
vpGaussRand noise(0.5, 10);
for(int i=0; i< 10; i++) {
std::cout << "noise " << i << ": " << noise() << std::endl;
}
return 0;
}

Definition at line 121 of file vpNoise.h.

Constructor & Destructor Documentation

vpGaussRand::vpGaussRand ( )
inline

Default noise generator constructor.

Definition at line 133 of file vpNoise.h.

vpGaussRand::vpGaussRand ( const double  sigma_val,
const double  mean_val,
const long  noise_seed = 0 
)
inline

Gaussian noise random generator constructor.

Parameters
sigma_val: Standard deviation.
mean_val: Mean value.
noise_seed: Seed of the noise

Definition at line 142 of file vpNoise.h.

Member Function Documentation

double vpUniRand::draw1 ( )
protectedinherited

Bays-Durham Shuffling of Park-Miller generator.

Minimal random number generator of Park and Miller with Bays-Durham shuffle. Returns a uniform random deviate between 0.0 and 1.0 (exclusive of the endpoint values).

Definition at line 83 of file vpNoise.cpp.

References vpUniRand::x.

double vpGaussRand::operator() ( )
inline

Return a random value from the Gaussian noise generator.

Definition at line 168 of file vpNoise.h.

void vpGaussRand::seed ( const long  seed_val)
inline

Set the seed of the noise.

Parameters
seed_val: New seed.

Definition at line 161 of file vpNoise.h.

References vpUniRand::x.

void vpGaussRand::setSigmaMean ( const double  sigma_val,
const double  mean_val 
)
inline

Set the standard deviation and mean for gaussian noise.

Parameters
sigma_val: New standard deviation sigma.
mean_val: New mean value.

Definition at line 151 of file vpNoise.h.

Member Data Documentation

long vpUniRand::x
protectedinherited

Definition at line 83 of file vpNoise.h.

Referenced by vpUniRand::draw1(), and seed().