# | 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 | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |