dimanche 19 avril 2015

Java: Generate N random numbers which mean is going to be M

I didn't manage to find such function in Math.random or Util.random. For example I give a mean of 2 and generate N random numbers which when I average them the average to be the number (in this case 2) which I gave to the function.



public static int[] randomNumbersWithGivenMean(int average)
{
...
}




Aucun commentaire:

Enregistrer un commentaire