# Random¶

## xt::random::seed¶

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::randint

## xt::random::randn¶

xt::random::randn

## xt::random::binomial¶

xt::random::binomial

## xt::random::geometric¶

xt::random::geometric

## xt::random::negative_binomial¶

xt::random::negative_binomial

## xt::random::poisson¶

xt::random::poisson

## xt::random::exponential¶

xt::random::exponential

## xt::random::gamma¶

xt::random::gamma

Produces (an array of) random positive floating-point values, distributed according to the probability density:

$P(x) = x^{\alpha-1} \frac{e^{-x / \beta}}{\beta^\alpha \; \Gamma(\alpha)}$

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¶

xt::random::weibull

Produces (an array of) random positive floating-point values, distributed according to the probability density:

$P(x) = \frac{a}{b} \left( \frac{x}{b} \right)^{a - 1} e^{-(x / b)^a}$

where $$a > 0$$ is the shape parameter and $$b > 0$$ the scale parameter. In particular, a random variable is produced as

$X = b (- \ln (U))^{1/a}$

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.

## xt::random::extreme_value¶

xt::random::extreme_value

## xt::random::lognormal¶

xt::random::lognormal

## xt::random::cauchy¶

xt::random::cauchy

## xt::random::fisher_f¶

xt::random::fisher_f

## xt::random::student_t¶

xt::random::student_t

## xt::random::choice¶

xt::random::choice

## xt::random::shuffle¶

xt::random::shuffle

## xt::random::permutation¶

xt::random::permutation