HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

PRNG for a gaussian distribution?

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
prngdistributionforgaussian

Problem

I need suggestions for algorithm for Pseudo random number generators that will produce a near gaussian distribution (bell curve) for automatically generating test data. I know that PRNG produce recurring 'patterns, but google has revealed none that expressively produce gaussian distributions. Do you have an recommendations ideally I'd like several suggestions to produce multiple different test datasets usable for automated testing.

Solution

You can generate any distribution by using a standard PRNG to choose $X$ uniformly from the interval $[0,1]$ and then returning $F^{-1}(X)$, where $F$ is the cumulative distribution function of the distribution you're interested in.

For the Gaussian distribution, though, it's usually better to use Box–Muller or ziggurat.

Context

StackExchange Computer Science Q#102705, answer score: 6

Revisions (0)

No revisions yet.