mercredi 28 avril 2021

How can I generate random numbers which fall in a normal distribution pattern?

I will need to initialize an 'n' number of classes that will have a random value attached to them from 1 to 100.

I know how to create a random value between 1 and 100 but how can I make all the values to fall in a the normal distribution pattern?

+ (int)randomIntBetweenMinimum:(int)minimum maximum:(int)maximum {
    
    return (int)(minimum + arc4random_uniform(maximum - minimum + 1.0f));
}



Aucun commentaire:

Enregistrer un commentaire