* Alejandro Colomar <alx.manpages@xxxxxxxxx>, 2023-01-01 17:27:
arc4random_uniform() returns a random number less than upper_bound for
valid input, or 0 when upper_bound is invalid.
Is the "or 0 ..." thing part of the API? I could find anything like that
in glibc docs or BSD man pages.
STANDARDS
These nonstandard functions are present in several Unix systems.
That's not really helpful. Also, the VERSIONS section is missing ("every
new interface should include a VERSIONS section").
In contrast, the libbsd man page is much more informative:
These functions first appeared in OpenBSD 2.1, FreeBSD 3.0, NetBSD
1.6, and DragonFly 1.0. The functions arc4random(), arc4random_buf()
and arc4random_uniform() appeared in glibc 2.36.
The original version of this random number generator used the RC4 (also
known as ARC4) algorithm. In OpenBSD 5.5 it was replaced with the
ChaCha20 cipher, and it may be replaced again in the future as
cryptographic techniques advance. A good mnemonic is “A Replacement
Call for Random”.
--
Jakub Wilk