We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

# Normal distribution generator

on
Medium Priority
1,190 Views
does anyone know where on the net i may find a source code
of a normal distibution generator class ?
i need to compile it on an open-VMS environment, so using
UNIX c++ libraries is out of the question.
tia /erel.
Comment
Watch Question

## View Solution Only

Commented:
Generate two uniformly distributed random numbers in
the interval [0, 1], say u and v; then

x1= sqrt(-2*ln(u))*cos(2*pi*v)

and

x2= sqrt(-2*ln(u))*sin(2*pi*v)

both are N(0,1). make your choice

Another (worse, but fast) method is:

generate 12 U(0, 1) random numbers; add them and
subtract 6, ie, sum(i= 1, 12)(x[i]])-6; don't expect much
accuracy near the extremes of the N(0,1) function value

kind regards,

Jos aka jos@and.nl

Not the solution you were looking for? Getting a personalized solution is easy.

Commented:
You might try searching this address: http://www.karland.com/code/
Access more of Experts Exchange with a free account
##### Thanks for using Experts Exchange.

Limited access with a free account allows you to:

• View three pieces of content (articles, solutions, posts, and videos)
• Ask the experts questions (counted toward content limit)
• Customize your dashboard and profile