|
Autopysta
|
Utility class for generating random numbers. More...
#include <random_generator.h>
Static Public Member Functions | |
| static void | init () |
| Initialize the random number generator with a seed. | |
| static double | uniform (double a, double b) |
| Generate a random value from a uniform distribution [a, b]. | |
| static double | uniform01 () |
| Generate a random value from a standard uniform distribution [0, 1]. | |
| static double | logistic (double mu, double s) |
| Generate a random value from a logistic distribution. | |
| static double | normal (double mu, double sigma) |
| Generate a random value from a normal (Gaussian) distribution. | |
Utility class for generating random numbers.
The random_generator class provides static methods to generate random values from different probability distributions. These include the uniform, standard uniform, logistic, and normal distributions. The class uses a Mersenne Twister pseudo-random generator.
|
static |
Initialize the random number generator with a seed.
This method initializes the Mersenne Twister generator using the current time as the seed. This ensures that the generator produces different random sequences each time the program runs.
|
static |
Generate a random value from a logistic distribution.
This method returns a random value sampled from a logistic distribution with location mu and scale s. The logistic distribution is commonly used in various models, including machine learning and statistics.
| mu | The location parameter of the logistic distribution (mean). |
| s | The scale parameter (related to the standard deviation). |
|
static |
Generate a random value from a normal (Gaussian) distribution.
This method returns a random value sampled from a normal distribution with mean mu and standard deviation sigma.
| mu | The mean of the normal distribution. |
| sigma | The standard deviation of the normal distribution. |
|
static |
Generate a random value from a uniform distribution [a, b].
This method returns a random value sampled from a uniform distribution with bounds a and b.
| a | The minimum value of the distribution. |
| b | The maximum value of the distribution. |
a and b.
|
static |
Generate a random value from a standard uniform distribution [0, 1].
This method returns a random value sampled from a uniform distribution between 0 and 1.