[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-gsl] Reg :: My Gaussian Random Number Code
From: |
John D Lamb |
Subject: |
Re: [Help-gsl] Reg :: My Gaussian Random Number Code |
Date: |
Wed, 23 Jun 2010 07:33:56 +0100 |
On Tue, 2010-06-22 at 13:04 +0200, Sumit Adhikari wrote:
> P gauss_rand = sigma*y*sqrt(-2.0*log(rad)/rad) ;
> return (gauss_rand);
The code looks correct. If you want a quick, simple test generate a few
hundred pairs of variates and produce a scatter plot.
The code is, however, not particularly efficient. The gsl_ran_gaussian
code should run faster and the gsl_ran_gaussian_ziggurat code faster
still. Even a simple Box–Müller generator should be quicker because you
can get two Gaussian variates from two random numbers.
--
JDL