Station 5: These are the scaffolding tools Grace provides.
randomBetween() generates random numbers, coinFlip()
returns true/false randomly, and choose() picks between two values.
// ============================================================
// HELPER FUNCTIONS (Grace's scaffolding tools)
// ============================================================
function randomBetween(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function coinFlip() {
return Math.random() < 0.5;
}
function choose(condition, ifTrue, ifFalse) {
return condition ? ifTrue : ifFalse;
}