https://www.freebsd.org/cgi/man.cgi?query=arc4random The example: #define foo4random() (arc4random() % ((unsigned)RAND_MAX + 1)) would be better as: #define foo4random() (arc4random_uniform((unsigned)RAND_MAX))
Perhaps, although there was no guarantee old rand() was uniformly distributed either? Better to provide examples of _uniform() API use, though.
A commit references this bug: Author: cem Date: Thu Mar 21 14:45:09 UTC 2019 New revision: 345380 URL: https://svnweb.freebsd.org/changeset/base/345380 Log: arc4random: Adjust example code to use uniform() API PR: 236678 Reported by: Andras Farkas <deepbluemistake AT gmail.com> Changes: head/lib/libc/gen/arc4random.3