Last active
October 7, 2023 23:22
-
-
Save jorendorff/11c5dfd84d1f9d1bb2d6 to your computer and use it in GitHub Desktop.
Make a random7 function from a random5 function.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function random7() { | |
while (true) { | |
var n = random5() + 5 * random5(); | |
if (n < 21) | |
return n % 7; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment