-
-
Save usmaanalii/8f40b02e6691b8967ed2276d0b0ff46f to your computer and use it in GitHub Desktop.
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
let lastHole; | |
function randomHole(holes) { | |
const idx = Math.floor(Math.random() * holes.length); | |
const hole = holes[idx]; | |
if (lastHole === hole) { | |
return randomHole(holes); | |
} | |
lastHole = hole; | |
return hole; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment