I want to split 10 into an array of 4 random numbers, but neither can be 0 or higher than 4. For example [1,2,3,4],
10
0
4
[1,2,3,4]
this calculates a random number from 1 to 4
wrap it on a function to your needs to generate the arrays
Math.floor(Math.random() * 4) + 1
var randomNumber = Math.floor(Math.random() * 4) + 1 ; console.log(randomNumber);