diff options
Diffstat (limited to 'sys/dev/rnd.c')
-rw-r--r-- | sys/dev/rnd.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/rnd.c b/sys/dev/rnd.c index 328919de450..15a5e0543f2 100644 --- a/sys/dev/rnd.c +++ b/sys/dev/rnd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rnd.c,v 1.89 2008/06/09 07:07:16 djm Exp $ */ +/* $OpenBSD: rnd.c,v 1.90 2008/06/09 23:03:16 djm Exp $ */ /* * rnd.c -- A strong random number generator @@ -625,8 +625,8 @@ arc4random_uniform(u_int32_t upper_bound) if (upper_bound > 0x80000000) min = 1 + ~upper_bound; /* 2**32 - upper_bound */ else { - /* (2**32 - (x * 2)) % x == 2**32 % x when x <= 2**31 */ - min = ((0xffffffff - (upper_bound * 2)) + 1) % upper_bound; + /* (2**32 - x) % x == 2**32 % x when x <= 2**31 */ + min = ((0xffffffff - upper_bound) + 1) % upper_bound; } #endif |