I’m trying to generate a random Gaussian double in Objective-C (the same as random.nextGaussian in Java). However rand_gauss() doesn’t seem to work. Anyone know a way of achieving this?
I’m trying to generate a random Gaussian double in Objective-C (the same as random.nextGaussian
Share
This link shows how to calculate it using the standard
random()function.I should note that you’ll likely have to make the
ranf()routine that converts the output ofrandom()from[0,MAX_INT]to be from[0,1], but that shouldn’t be too difficult.From the linked article: