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 flip() { | |
return Math.random() >= 0.5; | |
} | |
function randomNumber(n) { | |
if(n === undefined) throw new Error("n is required"); | |
if(n <= 0) throw new Error("n must be greater than 0"); | |
if(n > 1000000) throw new Error("n must be lower than 1,000,000"); | |
// No need to further calculations |