lundi 3 août 2020

generating a random number in a specific range with normal distribution in java [duplicate]

I want to produce a random number in range between 1 and 100 with normal distribution. For uniformly generated number I use the following:

1 + (100-1)*Math.random();

however, the above code produces a number with uniform distribution. I was wondering how I can generate a random number in range 1 and 100 with normal distribution in java? Thank you in advance for your help.

I have seen similar question posted here: Java normal distribution but this does not answer my question.




Aucun commentaire:

Enregistrer un commentaire