MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: normal distribution random number generation

  • To: mathgroup at
  • Subject: [mg51143] Re: [mg51113] normal distribution random number generation
  • From: Andrzej Kozlowski <akoz at>
  • Date: Wed, 6 Oct 2004 04:34:18 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

The problem is not actually with the way Mathematica's 
NormalDistribution but with the uniformly distributed Random[] 
NormalDistribution itself is generated (in the package 
Statistics`NormalDistribution`) by means of the very classical so 
called Boox-Muller method (although actually the Marsaglia variant 
below works better). You can try downolading my little 
RandomReplacement package form one of my web sites:  in Japan

or   in Poland

The package is based on the post of daniel Lichtblau, which explains 
the nature of the problem:


The package is named init.m and can be loaded automatically at the 
start of each Mathematica session.
However, in fact if you are only concerned with normal distributions it 
may be enough to the following. First load the (unmodified)  
NormalDistribution package using


and then evaluate the code below. It will replace the Box-Muller 
generator by the Marsaglia one. I have found that this is usually 
enough. But if your problem still remains try the RandomReplacement 
package. (Or you can use both of course). Here is the Marsaglia code 
for normal distribution:


On 5 Oct 2004, at 17:36, Chris Kunkel wrote:

> *This message was transferred with a trial version of CommuniGate(tm) 
> Pro*
> Hello,
> Recently I have encountered a problem in Mathematica's normal
> distribution random number generator.  The problem arises when I look
> at the distribution of averages of a list of theses numbers.  That is,
> I generate 1000 numbers and take their average.  I do this a number of
> times and the plot a frequency distribution.  Consistently it seems to
> be skewed positive.  Specifically, the number of occurrences less than
> 3 standard deviations is consistent with the expected number, but the
> number greater than 3 is always larger (in some cases about twice the
> expected number).
> I was wondering if anyone else has noticed this and knows of a fix.
> Also, does anyone have code for a good quality normal distribution
> random number generator?
> Chris

  • Prev by Date: Re: normal distribution random number generation
  • Next by Date: Re: Re: Re: Conditinal Plots
  • Previous by thread: Re: normal distribution random number generation
  • Next by thread: Re: normal distribution random number generation