]> granicus.if.org Git - libevent/commit
Optimize arc4random_uniform() (by syncing with OpenBSD implementation) master
authorCœur <coeur@gmx.fr>
Thu, 2 Mar 2023 04:41:11 +0000 (12:41 +0800)
committerAzat Khuzhin <azat@libevent.org>
Thu, 2 Mar 2023 06:51:14 +0000 (07:51 +0100)
commit557990cad33f1b06a1e2a416231d79590237dd2e
tree08040d1c1ec1ef7118d33c0e669179a0f86d6080
parente96e98aea5ed9f69641e74b39153747218990bdc
Optimize arc4random_uniform() (by syncing with OpenBSD implementation)

1. In d4de062, in Feb 2010, libevent adopted OpenBSD implementation of
   arc4random_uniform.
2. In
   https://github.com/openbsd/src/commit/728918cba93e0418bea2a73c9784f6b80c2a9dbd,
   in Jun 2012, OpenBSD improved their implementation to be faster, by
   changing arc4random_uniform() to calculate ``2**32 % upper_bound'' as
   ``-upper_bound % upper_bound''.

Alternatively we can simply remove arc4random_uniform() since it is not
used by libevent anyway, but let's just sync the header for now.
arc4random.c