| 248 | } |
| 249 | |
| 250 | static double random_error() |
| 251 | { |
| 252 | // Irwin-Hall approximation to normal distribution with n = 3; varies in (-3,3) |
| 253 | return (rng.drandom0() + rng.drandom0() + rng.drandom0()) * 2.0 - 3.0; |
| 254 | } |
| 255 | |
| 256 | // round() is only available in C++11 |
| 257 | static int int_round (double val) |