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]. More...
|
|
static double | scalar (double min, double max) |
| Get a random number from a uniform distribution in the range [min,max]. More...
|
|
static yarp::sig::Vector | vector (int s) |
| Get a vector of random numbers from a uniform distribution, values are in the range [0, 1]. More...
|
|
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]. More...
|
|
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. More...
|
|
static void | init () |
| Initialize the random number generator, with current time (time(0)). More...
|
|
static void | init (int seed) |
| Initialize the random number generator, provide a seed. More...
|
|
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 41 of file Rand.h.
◆ init() [1/2]
Initialize the random number generator, with current time (time(0)).
Definition at line 72 of file Rand.cpp.
◆ init() [2/2]
void Rand::init |
( |
int |
seed | ) |
|
|
static |
Initialize the random number generator, provide a seed.
- Parameters
-
Definition at line 77 of file Rand.cpp.
◆ matrix()
Matrix Rand::matrix |
( |
int |
r, |
|
|
int |
c |
|
) |
| |
|
static |
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 105 of file Rand.cpp.
◆ scalar() [1/2]
Get a random number from a uniform distribution in the range [0,1].
Definition at line 62 of file Rand.cpp.
◆ scalar() [2/2]
double Rand::scalar |
( |
double |
min, |
|
|
double |
max |
|
) |
| |
|
static |
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 67 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 93 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 82 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