A static class grouping function for uniform random number generator.
More...
#include <yarp/math/Rand.h>
|
static double | scalar () |
| Get a random number from a uniform distribution in the range [0,1].
|
|
static double | scalar (double min, double max) |
| Get a random number from a uniform distribution in the range [min,max].
|
|
static yarp::sig::Vector | vector (int s) |
| Get a vector of random numbers from a uniform distribution, values are in the range [0, 1].
|
|
static yarp::sig::Matrix | matrix (int r, int c) |
| Get a vector of random numbers from a uniform distribution, values are in the range [0, 1].
|
|
static yarp::sig::Vector | vector (const yarp::sig::Vector &min, const yarp::sig::Vector &max) |
| Get a vector of random numbers from a uniform distribution, values are in the range [min, max], for each components.
|
|
static void | init () |
| Initialize the random number generator, with current time (time(0)).
|
|
static void | init (int seed) |
| Initialize the random number generator, provide a seed.
|
|
A static class grouping function for uniform random number generator.
Thread safe.
Methods inside this class provides access to a global instance of a RandScalar object that generates random numbers.
Definition at line 34 of file Rand.h.
◆ init() [1/2]
Initialize the random number generator, with current time (time(0)).
Definition at line 69 of file Rand.cpp.
◆ init() [2/2]
Initialize the random number generator, provide a seed.
- Parameters
-
Definition at line 74 of file Rand.cpp.
◆ matrix()
Get a vector of random numbers from a uniform distribution, values are in the range [0, 1].
- Parameters
-
r | number of rows |
c | number of columns |
- Returns
- the random matrix
Definition at line 102 of file Rand.cpp.
◆ scalar() [1/2]
Get a random number from a uniform distribution in the range [0,1].
Definition at line 59 of file Rand.cpp.
◆ scalar() [2/2]
Get a random number from a uniform distribution in the range [min,max].
- Parameters
-
min | lower bound |
max | upper bound |
- Returns
- return value
Definition at line 64 of file Rand.cpp.
◆ vector() [1/2]
Get a vector of random numbers from a uniform distribution, values are in the range [min, max], for each components.
The function determines the size of the vector from the parameters.
- Parameters
-
min | a vector whose components specify the lower bound of the distribution. |
max | a vector whose components specify the upper bound of the distribution |
- Returns
- the random vector
Definition at line 90 of file Rand.cpp.
◆ vector() [2/2]
Get a vector of random numbers from a uniform distribution, values are in the range [0, 1].
- Parameters
-
- Returns
- the random vector
Definition at line 79 of file Rand.cpp.
The documentation for this class was generated from the following files:
- src/libYARP_math/src/yarp/math/Rand.h
- src/libYARP_math/src/yarp/math/Rand.cpp