Yeah it is very possible to do what you're asking
const diceRoll = Array.from({ length: 100 }, (_, i) => {
return i + 1
});
console.log(Math.random() * diceRoll.length);
The code there, why it works is that Math.random returns a random number between 0 and whatever value we set andβ¦
Top comments (0)