lundi 7 septembre 2020

Probability of generating a specific random number in java

If I have a random number generator that generates numbers 0-1, is there a way that I can increase the probability of it generating certain numbers? Say that the values .5+ on the random number generator are equal to the color blue and numbers lower are equal to red. Can I make it so that the user can enter a number as a percentage in order to increase/decrease the likelihood of generating the color red?




Aucun commentaire:

Enregistrer un commentaire