So say i have an array:
array1 = [1, 2, 3, 4, 5, ........, 50]
And I wanted to randomize that array into a new array that has length contraints.
For example, if I wanted a random array from array1 that was only 5 numbers long, I could get:
var arrayLength = 5
randomizedArray = [6, 20, 45, 2, 13]
Is there a way to do this with Math.random?
Aucun commentaire:
Enregistrer un commentaire