Visual Servoing Platform
version 3.2.0 under development (2019-01-22)
|
#include <visp3/core/vpGaussRand.h>
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 |
Class for generating random number with normal probability density.
The algorithms and notations used are described in [14].
The code below shows how to use the random generator to get values that have their mean equal to 10 with a standart deviation equal to 0.5.
The previous example produces the following printings:
Note that the previous example produces always the same "random" results. To produce real random values, you need to initialize the random generator with different values using seed(). For example, this could be done using the current time. The code becomes:
Now if you run the previous example you will always get different values:
Definition at line 120 of file vpGaussRand.h.
|
inline |
Default noise generator constructor.
Definition at line 131 of file vpGaussRand.h.
|
inline |
Gaussian noise random generator constructor.
sigma_val | : Standard deviation. |
mean_val | : Mean value. |
noise_seed | : Seed of the noise |
Definition at line 140 of file vpGaussRand.h.
|
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 62 of file vpUniRand.cpp.
References vpUniRand::x.
|
inline |
Return a random value from the Gaussian noise generator.
Definition at line 167 of file vpGaussRand.h.
|
inline |
Set the seed of the noise.
seed_val | : New seed. |
Definition at line 162 of file vpGaussRand.h.
|
inline |
Set the standard deviation and mean for gaussian noise.
sigma_val | : New standard deviation sigma. |
mean_val | : New mean value. |
Definition at line 151 of file vpGaussRand.h.
|
protectedinherited |
Definition at line 78 of file vpUniRand.h.
Referenced by vpUniRand::draw1().