llvm-project/libcxx/test/std/numerics
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
..
bit [libc++] Implement P1272R4 (std::byteswap) 2021-11-22 01:28:18 +01:00
c.math [libc++] Add missing templated version of `std::lerp`. 2022-01-07 09:55:33 -05:00
cfenv/cfenv.syn [libc++] Remove obsolete 'newlib' Lit Feature 2020-06-12 14:08:18 -04:00
complex.number [libc++][CI] Add AIX pipeline config 2021-11-08 10:30:27 -05:00
numarray [libc++] P0433R2: add the remaining deduction guides. 2021-10-28 11:09:51 -07:00
numbers [libc++][test] Portably silence warnings 2020-10-19 08:33:58 -07:00
numeric.ops [libc++][CI] Add AIX pipeline config 2021-11-08 10:30:27 -05:00
numeric.requirements
numerics.general
rand [libc++] Start using `arc4random()` to implement `std::random_device` on Apple 2022-01-12 11:24:23 -05:00