Random Math
Compare a random decimal with its rounded values.
Number from 0 up to 10
Random value: -
Math.floor(): -
Math.ceil(): -
Important JavaScript
Math.floor rounds down; Math.ceil rounds up. Multiply and add to get a whole-number roll.
console.log(Math.floor(4.8)); // 4
console.log(Math.ceil(4.2)); // 5
const roll = Math.floor(Math.random() * 6) + 1;