Skip to content

Commit

Permalink
Fix correctness in the rejection calculation.
Browse files Browse the repository at this point in the history
  • Loading branch information
lgarron committed Jun 6, 2024
1 parent 7563548 commit 44ad379
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/random-uint-below/randomUIntBelow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function randomUIntBelow(max: number): number {
val = random53BitNumber();
block = Math.floor(val / max);
blockMax = block * max;
if (blockMax < MAX_JS_PRECISE_INT - block) {
if (blockMax < MAX_JS_PRECISE_INT - max) {
return val - blockMax;
}
}
Expand Down

0 comments on commit 44ad379

Please sign in to comment.