![]() |
Visual Servoing Platform
version 3.3.0
|
#include <vpGaussRand.h>
Public Member Functions | |
vpGaussRand () | |
vpGaussRand (double sigma_val, double mean_val, long noise_seed=0) | |
void | setSigmaMean (double sigma_val, double mean_val) |
void | seed (long seed_val) |
double | operator() () |
Class for generating random number with normal probability density.
The algorithms and notations used are described in [Gentle:2004].
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 119 of file vpGaussRand.h.
|
inline |
Default noise generator constructor.
Definition at line 134 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 143 of file vpGaussRand.h.
|
inline |
Return a random value from the Gaussian noise generator.
Definition at line 170 of file vpGaussRand.h.
|
inline |
Set the seed of the noise.
seed_val | : New seed. |
Definition at line 165 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 154 of file vpGaussRand.h.