I would like to generate a random integer between 0,5 for example on the App using something like:
let pick = Math.randomInt(0,5);
Is there a way to do that? I get Type.error expected a function. I saw somewhere else on here that someone was able to use Math.Random()... I looked over the API but I'm not sure what has to be imported to get access to this function. Thanks.
Answered! Go to the Best Answer.
Best AnswerI've been using Math.random() with Math.floor() and I've not had to import anything extra.
var diceSize = 4;
function roll() {
return Math.floor(Math.random() * Math.floor(diceSize)) + 1;
}
Best Answer