Random
xt::random::seed()
Set seed for random number generator. A common practice to get a ‘real’ random number is to use:
#include <ctime>
...
xt::random::seed(time(NULL));
xt::random::rand()
xt::random::randint()
xt::random::randn()
xt::random::binomial()
xt::random::geometric()
xt::random::negative_binomial()
xt::random::poisson()
xt::random::exponential()
xt::random::gamma()
Produces (an array of) random positive floating-point values, distributed according to the probability density:
where \(\alpha\) is the shape (also known as \(k\)) and \(\beta\) the scale (also known as \(\theta\)), and \(\Gamma\) is the Gamma function.
Note
Different from NumPy, the first argument is the shape of the output array.
xt::random::weibull()
Produces (an array of) random positive floating-point values, distributed according to the probability density:
where \(a > 0\) is the shape parameter and \(b > 0\) the scale parameter. In particular, a random variable is produced as
where \(U\) is drawn from the uniform distribution (0, 1].
By default both the shape \(a = 1\) and the scale \(b = 1\). Note that you can specify only \(a\) while choosing the default for \(b\).
Note
Different from NumPy, the first argument is the shape of the output array.