Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96630152
d_gauss.c
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Dec 29, 06:08
Size
486 B
Mime Type
text/x-c
Expires
Tue, Dec 31, 06:08 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23219073
Attached To
R1448 Lenstool-HPC
d_gauss.c
View Options
#include<math.h>
#include<fonction.h>
/* -------------------------------------------------------------------
double gauss()
purpose: draw numbers under an gaussian law
-------------------------------------------------------------------*/
double d_gauss(double sig, int *idum)
{
double x, z, r;
while ( (z = pow(x = d_random(idum) - 0.5, 2.0) + pow(d_random(idum) - 0.5, 2.0) ) > 0.25 );
while ((r = d_random(idum)) <= 0.0);
return sig*sqrt(-2.0*log(r) / z)*x;
}
Event Timeline
Log In to Comment