llvm-project/libcxx/include/__random
Louis Dionne d202c76441 [libc++] Start using `arc4random()` to implement `std::random_device` on Apple
On Apple platforms, arc4random is faster than /dev/urandom, and it is
the recommended user-space RNG according to Apple's own OS folks.

This commit adds an ABI switch to guard ABI-break-protections in
std::random_device, and starts using arc4random instead of /dev/urandom
to implement std::random_device on Apple platforms.

Note that previously, `std::random_device` would allow passing a custom
token to its constructor, and that token would be interpreted as the name
of a file to read entropy from. This was implementation-defined and
undocumented. After this change, Apple platforms will be using arc4random()
instead, and any custom token passed to the constructor will be ignored.
This behavioral change will also impact other platforms that use the
arc4random() implementation, such as OpenBSD. This should be fine since
that is effectively a relaxation of the constructor's requirements.

rdar://86638350

Differential Revision: https://reviews.llvm.org/D116045
2022-01-12 11:24:23 -05:00
..
bernoulli_distribution.h
binomial_distribution.h
cauchy_distribution.h
chi_squared_distribution.h [libc++] Alphabetize header #includes. NFCI. 2022-01-10 16:30:38 -05:00
clamp_to_integral.h [libc++] Extract __clamp_to_integral to its own header 2021-12-08 08:33:37 -05:00
default_random_engine.h
discard_block_engine.h
discrete_distribution.h
exponential_distribution.h
extreme_value_distribution.h
fisher_f_distribution.h
gamma_distribution.h [libc++] Alphabetize header #includes. NFCI. 2022-01-10 16:30:38 -05:00
generate_canonical.h
geometric_distribution.h
independent_bits_engine.h
is_seed_sequence.h
knuth_b.h
linear_congruential_engine.h
log2.h [libc++] Fix `uniform_int_distribution` for 128-bit result type 2021-12-01 11:03:29 -05:00
lognormal_distribution.h
mersenne_twister_engine.h
negative_binomial_distribution.h
normal_distribution.h
piecewise_constant_distribution.h
piecewise_linear_distribution.h
poisson_distribution.h [libc++] Extract __clamp_to_integral to its own header 2021-12-08 08:33:37 -05:00
random_device.h [libc++] Start using `arc4random()` to implement `std::random_device` on Apple 2022-01-12 11:24:23 -05:00
ranlux.h
seed_seq.h [libc++] `= delete` member functions with // = delete; 2021-12-08 19:29:44 +01:00
shuffle_order_engine.h
student_t_distribution.h
subtract_with_carry_engine.h
uniform_int_distribution.h [libc++] Fix `uniform_int_distribution` for 128-bit result type 2021-12-01 11:03:29 -05:00
uniform_random_bit_generator.h
uniform_real_distribution.h
weibull_distribution.h