summaryrefslogtreecommitdiff
path: root/openbsd-compat/bsd-arc4random.c
diff options
context:
space:
mode:
Diffstat (limited to 'openbsd-compat/bsd-arc4random.c')
-rw-r--r--openbsd-compat/bsd-arc4random.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/openbsd-compat/bsd-arc4random.c b/openbsd-compat/bsd-arc4random.c
index 92e7e7b58..9d4c8690e 100644
--- a/openbsd-compat/bsd-arc4random.c
+++ b/openbsd-compat/bsd-arc4random.c
@@ -129,7 +129,7 @@ arc4random_uniform(u_int32_t upper_bound)
129 min = 1 + ~upper_bound; /* 2**32 - upper_bound */ 129 min = 1 + ~upper_bound; /* 2**32 - upper_bound */
130 else { 130 else {
131 /* (2**32 - (x * 2)) % x == 2**32 % x when x <= 2**31 */ 131 /* (2**32 - (x * 2)) % x == 2**32 % x when x <= 2**31 */
132 min = ((0xffffffff - (upper_bound << 2)) + 1) % upper_bound; 132 min = ((0xffffffff - (upper_bound * 2)) + 1) % upper_bound;
133 } 133 }
134#endif 134#endif
135 135