Location via proxy:
[ UP ]
[Report a bug]
[Manage cookies]
No cookies
No scripts
No ads
No referrer
Show this form
29
Numerics library
[numerics]
29.5
Random number generation
[rand]
29.5.2
Header
<random>
synopsis
[rand.synopsis]
#include
<
initializer_list
>
// see
[initializer.
list.
syn]
namespace
std
{
//
[rand.
req.
urng]
, uniform random bit generator requirements
template
<
class
G
>
concept
uniform_random_bit_generator
=
see below
;
// freestanding
//
[rand.
eng.
lcong]
, class template
linear_
congruential_
engine
template
<
class
UIntType, UIntType a, UIntType c, UIntType m
>
class
linear_congruential_engine;
// partially freestanding
//
[rand.
eng.
mers]
, class template
mersenne_
twister_
engine
template
<
class
UIntType, size_t w, size_t n, size_t m, size_t r, UIntType a, size_t u, UIntType d, size_t s, UIntType b, size_t t, UIntType c, size_t l, UIntType f
>
class
mersenne_twister_engine;
//
[rand.
eng.
sub]
, class template
subtract_
with_
carry_
engine
template
<
class
UIntType, size_t w, size_t s, size_t r
>
class
subtract_with_carry_engine;
// partially freestanding
//
[rand.
adapt.
disc]
, class template
discard_
block_
engine
template
<
class
Engine, size_t p, size_t r
>
class
discard_block_engine;
// partially freestanding
//
[rand.
adapt.
ibits]
, class template
independent_
bits_
engine
template
<
class
Engine, size_t w,
class
UIntType
>
class
independent_bits_engine;
// partially freestanding
//
[rand.
adapt.
shuf]
, class template
shuffle_
order_
engine
template
<
class
Engine, size_t k
>
class
shuffle_order_engine;
//
[rand.
eng.
philox]
, class template
philox_
engine
template
<
class
UIntType, size_t w, size_t n, size_t r, UIntType
.
.
.
consts
>
class
philox_engine;
//
[rand.
predef]
, engines and engine adaptors with predefined parameters
using
minstd_rand0
=
see below
;
// freestanding
using
minstd_rand
=
see below
;
// freestanding
using
mt19937
=
see below
;
// freestanding
using
mt19937_64
=
see below
;
// freestanding
using
ranlux24_base
=
see below
;
// freestanding
using
ranlux48_base
=
see below
;
// freestanding
using
ranlux24
=
see below
;
// freestanding
using
ranlux48
=
see below
;
// freestanding
using
knuth_b
=
see below
;
using
philox4x32
=
see below
;
using
philox4x64
=
see below
;
using
default_random_engine
=
see below
;
//
[rand.
device]
, class
random_
device
class
random_device;
//
[rand.
util.
seedseq]
, class
seed_
seq
class
seed_seq;
//
[rand.
util.
canonical]
, function template
generate_
canonical
template
<
class
RealType, size_t digits,
class
URBG
>
RealType generate_canonical
(
URBG
&
g
)
;
namespace
ranges
{
//
[alg.
rand.
generate]
,
generate_
random
template
<
class
R,
class
G
>
requires
output_
range
<
R, invoke_result_t
<
G
&
>
>
&
&
uniform_
random_
bit_
generator
<
remove_cvref_t
<
G
>
>
constexpr
borrowed_iterator_t
<
R
>
generate_random
(
R
&
&
r, G
&
&
g
)
;
template
<
class
G,
output_
iterator
<
invoke_result_t
<
G
&
>
>
O,
sentinel_
for
<
O
>
S
>
requires
uniform_
random_
bit_
generator
<
remove_cvref_t
<
G
>
>
constexpr
O generate_random
(
O first, S last, G
&
&
g
)
;
template
<
class
R,
class
G,
class
D
>
requires
output_
range
<
R, invoke_result_t
<
D
&
, G
&
>
>
&
&
invocable
<
D
&
, G
&
>
&
&
uniform_
random_
bit_
generator
<
remove_cvref_t
<
G
>
>
&
&
is_arithmetic_v
<
invoke_result_t
<
D
&
, G
&
>
>
constexpr
borrowed_iterator_t
<
R
>
generate_random
(
R
&
&
r, G
&
&
g, D
&
&
d
)
;
template
<
class
G,
class
D,
output_
iterator
<
invoke_result_t
<
D
&
, G
&
>
>
O,
sentinel_
for
<
O
>
S
>
requires
invocable
<
D
&
, G
&
>
&
&
uniform_
random_
bit_
generator
<
remove_cvref_t
<
G
>
>
&
&
is_arithmetic_v
<
invoke_result_t
<
D
&
, G
&
>
>
constexpr
O generate_random
(
O first, S last, G
&
&
g, D
&
&
d
)
;
}
//
[rand.
dist.
uni.
int]
, class template
uniform_
int_
distribution
template
<
class
IntType
=
int
>
class
uniform_int_distribution;
// partially freestanding
//
[rand.
dist.
uni.
real]
, class template
uniform_
real_
distribution
template
<
class
RealType
=
double
>
class
uniform_real_distribution;
//
[rand.
dist.
bern.
bernoulli]
, class
bernoulli_
distribution
class
bernoulli_distribution;
//
[rand.
dist.
bern.
bin]
, class template
binomial_
distribution
template
<
class
IntType
=
int
>
class
binomial_distribution;
//
[rand.
dist.
bern.
geo]
, class template
geometric_
distribution
template
<
class
IntType
=
int
>
class
geometric_distribution;
//
[rand.
dist.
bern.
negbin]
, class template
negative_
binomial_
distribution
template
<
class
IntType
=
int
>
class
negative_binomial_distribution;
//
[rand.
dist.
pois.
poisson]
, class template
poisson_
distribution
template
<
class
IntType
=
int
>
class
poisson_distribution;
//
[rand.
dist.
pois.
exp]
, class template
exponential_
distribution
template
<
class
RealType
=
double
>
class
exponential_distribution;
//
[rand.
dist.
pois.
gamma]
, class template
gamma_
distribution
template
<
class
RealType
=
double
>
class
gamma_distribution;
//
[rand.
dist.
pois.
weibull]
, class template
weibull_
distribution
template
<
class
RealType
=
double
>
class
weibull_distribution;
//
[rand.
dist.
pois.
extreme]
, class template
extreme_
value_
distribution
template
<
class
RealType
=
double
>
class
extreme_value_distribution;
//
[rand.
dist.
norm.
normal]
, class template
normal_
distribution
template
<
class
RealType
=
double
>
class
normal_distribution;
//
[rand.
dist.
norm.
lognormal]
, class template
lognormal_
distribution
template
<
class
RealType
=
double
>
class
lognormal_distribution;
//
[rand.
dist.
norm.
chisq]
, class template
chi_
squared_
distribution
template
<
class
RealType
=
double
>
class
chi_squared_distribution;
//
[rand.
dist.
norm.
cauchy]
, class template
cauchy_
distribution
template
<
class
RealType
=
double
>
class
cauchy_distribution;
//
[rand.
dist.
norm.
f]
, class template
fisher_
f_
distribution
template
<
class
RealType
=
double
>
class
fisher_f_distribution;
//
[rand.
dist.
norm.
t]
, class template
student_
t_
distribution
template
<
class
RealType
=
double
>
class
student_t_distribution;
//
[rand.
dist.
samp.
discrete]
, class template
discrete_
distribution
template
<
class
IntType
=
int
>
class
discrete_distribution;
//
[rand.
dist.
samp.
pconst]
, class template
piecewise_
constant_
distribution
template
<
class
RealType
=
double
>
class
piecewise_constant_distribution;
//
[rand.
dist.
samp.
plinear]
, class template
piecewise_
linear_
distribution
template
<
class
RealType
=
double
>
class
piecewise_linear_distribution;
}