Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Random true / false in JS
function randomFromRange(start, end) {
return Math.round(Math.random() * (end - start) + start);
}
function randomTrueFalse() {
return randomFromRange(0, 1) ? true : false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment