Last active
February 1, 2021 10:31
-
-
Save kieranbarker/25b1b4b4cef14c65b10dcefdc462f6ee to your computer and use it in GitHub Desktop.
Get a random truthy/falsy value
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
/** | |
* Get a random truthy/falsy value | |
* {@link https://gist.github.com/kieranbarker/25b1b4b4cef14c65b10dcefdc462f6ee} | |
* @returns {Number} 1 (truthy) or 0 (falsy) | |
*/ | |
function fiftyFifty () { | |
return Math.round(Math.random()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Read the blog post:
https://kbarker.dev/blog/get-a-random-truthy-falsy-value-in-javascript/