Visual Servoing Platform
version 3.3.0 under development (2020-02-17)
|
#include <visp3/core/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 [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 135 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 144 of file vpGaussRand.h.
|
inline |
Return a random value from the Gaussian noise generator.
Definition at line 171 of file vpGaussRand.h.
|
inline |
Set the seed of the noise.
seed_val | : New seed. |
Definition at line 166 of file vpGaussRand.h.
References vpUniRand::setSeed().
|
inline |
Set the standard deviation and mean for gaussian noise.
sigma_val | : New standard deviation sigma. |
mean_val | : New mean value. |
Definition at line 155 of file vpGaussRand.h.