mercredi 22 novembre 2017

Generate random number in JavaScript but few numbers should be in less frequent

I am able to generate Random number from 0 to 10 using below code snippet, but I want frequency of 0 and 1 to be less when compared to any other number.

Math.floor(Math.random() * 10)

That would be great if someone provides me the solution without having external conditions to it.




Aucun commentaire:

Enregistrer un commentaire