let totalMoves = 0;
let carMoves = [];
while (totalMoves <= 100) {
let random = Math.floor(Math.random() * (6 - 0) + 1);
totalMoves = totalMoves + random;
carMoves.push(random);
console.log("Total Moves" + totalMoves);
}
I want to generate multiple random numbers from 0 to 6. And the total of all random numbers must be equal to 100 .. but this function is giving me a total value from 100 to 105