mercredi 20 décembre 2017

Select randomly 1 or 2 values from an array

I have an array made entirely of numbers :

indexes: number[]=[0 , 5 , 6 , 7 , 9 , 11 , 13 , 15]

What I want to do, is to select randomly 1 or 2 values from this array, than having these values as indexes of another array, again randomly to assign a value equal to 2 or 4, to the variables from the selected indexes.




Aucun commentaire:

Enregistrer un commentaire