generate random numbers
More...
#include <rand.h>
generate random numbers
Definition at line 43 of file rand.h.
static double g2o::tutorial::Rand::gauss_rand |
( |
double |
mean, |
|
|
double |
sigma |
|
) |
| |
|
inlinestatic |
Gaussian random with a mean and standard deviation. Uses the Polar method of Marsaglia.
Definition at line 50 of file rand.h.
References uniform_rand().
57 }
while (r2 > 1.0 || r2 == 0.0);
58 return mean + sigma * y * std::sqrt(-2.0 * log(r2) / r2);
static double uniform_rand(double lowerBndr, double upperBndr)
static void g2o::tutorial::Rand::seed_rand |
( |
| ) |
|
|
inlinestatic |
default seed function using the current time in seconds
Definition at line 72 of file rand.h.
74 seed_rand(static_cast<unsigned int>(std::time(NULL)));
static void g2o::tutorial::Rand::seed_rand |
( |
unsigned int |
seed | ) |
|
|
inlinestatic |
seed the random number generator
Definition at line 78 of file rand.h.
static double g2o::tutorial::Rand::uniform_rand |
( |
double |
lowerBndr, |
|
|
double |
upperBndr |
|
) |
| |
|
inlinestatic |
sample a number from a uniform distribution
Definition at line 64 of file rand.h.
66 return lowerBndr + ((double) std::rand() / (RAND_MAX + 1.0)) * (upperBndr - lowerBndr);
The documentation for this class was generated from the following file:
- /home/xuezhisd/CLionProjects/g2o/g2o/examples/tutorial_slam2d/rand.h