ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/math/MersenneTwister.hpp
(Generate patch)

Comparing trunk/OOPSE-4/src/math/MersenneTwister.hpp (file contents):
Revision 2611 by tim, Mon Mar 13 22:42:40 2006 UTC vs.
Revision 2632 by tim, Thu Mar 16 22:50:48 2006 UTC

# Line 184 | Line 184 | namespace oopse {
184    {
185      // Return a real number from a normal (Gaussian) distribution with given
186      // mean and variance by Box-Muller method
187 <    double r = sqrt( -2.0 * log( 1.0-randDblExc()) ) * variance;
187 >    assert(variance > 0);
188 >    double r = sqrt( -2.0 * log( 1.0-randDblExc()) * variance);
189      double phi = 2.0 * 3.14159265358979323846264338328 * randExc();
190      return mean + r * cos(phi);
191    }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines