Direct Graphical Models
v.1.7.0
|
Random number generation. More...
Functions | |
template<typename T > | |
T | u (T min, T max) |
Returns an integer random number with uniform distribution. More... | |
template<typename T > | |
T | U (T min=0, T max=1) |
Returns a floating-point random number with uniform distribution. More... | |
template<typename T > | |
T | N (T mu=0, T sigma=1) |
Returns a floating-point random number with normal distribution. More... | |
Mat | U (cv::Size size, int type, double min=0, double max=1) |
Returns a matrix of floating-point random numbers with uniform distribution. More... | |
Mat | N (cv::Size size, int type, double mu=0, double sigma=1) |
Returns a matrix of floating-point random numbers with normal distribution. More... | |
Random number generation.
This namespace collects methods for generating random numbers and vectors with uniform and normal distributions
|
inline |
Returns a floating-point random number with normal distribution.
This function generates random numbers according to the Normal (or Gaussian) random number distribution:
\[ f(x\,;\,\mu,\sigma)=\frac{1}{\sqrt{2\sigma^2\pi}} exp{\frac{-(x-\mu)^2}{2\sigma^2}} \]
This function is thread-safe
T | A floating-point type: float, double, or long double |
mu | The mean \(\mu\) |
sigma | The standard deviation \(\sigma\) |
Definition at line 63 of file random.h.
|
inline |
Returns a matrix of floating-point random numbers with normal distribution.
size | Size of the resulting matrix |
type | Type of the resulting matrix |
mu | The mean \(\mu\) |
sigma | The standard deviation \(\sigma\) |
|
inline |
Returns an integer random number with uniform distribution.
This function produces random integer values i, uniformly distributed on the closed interval [min, max], that is, distributed according to the discrete probability function:
\[ P(i\,|\,min,max)=\frac{1}{max-min+1}, min \leq i \leq max \]
This function is thread-safe
T | An integer type: short, int, long, long long, unsigned short, unsigned int, unsigned long, or unsigned long long |
min | The lower boudaty of the interval |
max | The upper boundary of the interval |
Definition at line 29 of file random.h.
|
inline |
Returns a floating-point random number with uniform distribution.
This function produces random floating-point values i, uniformly distributed on the interval [min, max), that is, distributed according to the probability function:
\[ P(i\,|\,min,max)=\frac{1}{max-min}, min \leq i < max \]
This function is thread-safe
T | A floating-point type: float, double, or long double |
min | The lower boudaty of the interval |
max | The upper boundary of the interval |
|
inline |
Returns a matrix of floating-point random numbers with uniform distribution.
size | Size of the resulting matrix |
type | Type of the resulting matrix |
min | The lower boundary |
max | The upper boundary |