mercredi 22 avril 2015

pick random shapes from array with Javascript

I have 6 shapes in array. I can select random shapes from array. Also I want to pick two or three shapes from array but I can't. I tried this code:

var range = _.sample(shapes, 2);

this code run but is not random.

var range = shapes.length-2 * Math.random();




Aucun commentaire:

Enregistrer un commentaire