From f501f070b50ed3e7da40512f86d1d9676f2fab5a Mon Sep 17 00:00:00 2001 From: Lucas Garron Date: Wed, 5 Jun 2024 00:08:04 -0700 Subject: [PATCH] Remove an extra `return`. --- src/random-uint-below/randomUIntBelow.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/random-uint-below/randomUIntBelow.ts b/src/random-uint-below/randomUIntBelow.ts index 55f1f92..d327025 100644 --- a/src/random-uint-below/randomUIntBelow.ts +++ b/src/random-uint-below/randomUIntBelow.ts @@ -45,7 +45,7 @@ export function randomUIntBelow(max: number): number { // val % max would produce a biased result. This bias can be very bad if `max` is on the order of MAX_JS_PRECISE_INT. We have to try again, so just call ourselves recursively. // For some values of `max` just above 9007199254740992 / 2, this happens about once on average. For other values of `max`, it's less than that (and for small values of `max` it's extremely unlikely). // TODO: Use more bits of accuracy instead of rejection sampling to avoid DoS. - return (val = random53BitNumber()); + val = random53BitNumber(); } return val % max; }