-1
$\begingroup$

I need a Pseudo random number generator algorithm that will produce a near gaussian distribution (bell curve) for automated test data purposes. I know that some PRNG will produce patterns, but none seem gaussian. Do you have an recommendations, ideally I will get several suggestions, usable for multiple automated tests.

New contributor
Martin of Hessle is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\endgroup$
  • $\begingroup$ You'd have got your answer 48 minutes faster by just Googling "pseudorandom gaussian"... $\endgroup$ – David Richerby Jan 11 at 12:07
  • $\begingroup$ @DavidRicherby, I did, there was nothing useful on the first couple of pages of Google, which is why I asked here. Most of the non uniformity was patterns not gaussian. $\endgroup$ – Martin of Hessle Jan 11 at 14:05
  • 1
    $\begingroup$ Perhaps your problem was using words like "pattern". I realize search results can vary depending on circumstances, but the first hit I get for the search term I suggested is Wikipedia's page on PRNGs, which has a section on non-uniform distributions, which mentions the general case and the Gaussian. The Wikipedia page on the Gaussian also has a section on how to generate samples computationally. And it's always worth checking Wikipedia for mathematics and algorithms questions. $\endgroup$ – David Richerby Jan 11 at 15:26
0
$\begingroup$

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.

$\endgroup$

Your Answer

Martin of Hessle is a new contributor. Be nice, and check out our Code of Conduct.

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.