diff options
author | Thomas White <taw@physics.org> | 2014-01-17 16:52:57 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2014-01-20 17:20:14 +0100 |
commit | 90ee3c269580104f2d16d28aeaa565063f6fc1f2 (patch) | |
tree | bd3c69f932648dc6fb01e4cce69bd27fb4831be2 /src/get_hkl.c | |
parent | 8e2f2f44f46c18f7bd621a2ef9a3d0aa813d76d9 (diff) |
RNG overhaul
Previously, we were using random(), which is really really bad.
Diffstat (limited to 'src/get_hkl.c')
-rw-r--r-- | src/get_hkl.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/get_hkl.c b/src/get_hkl.c index 454737b0..8ba77ebf 100644 --- a/src/get_hkl.c +++ b/src/get_hkl.c @@ -97,6 +97,9 @@ static void poisson_reflections(RefList *list, double adu_per_photon) { Reflection *refl; RefListIterator *iter; + gsl_rng *rng; + + rng = gsl_rng_alloc(gsl_rng_mt19937); for ( refl = first_refl(list, &iter); refl != NULL; @@ -106,10 +109,12 @@ static void poisson_reflections(RefList *list, double adu_per_photon) val = get_intensity(refl); - c = adu_per_photon * poisson_noise(val/adu_per_photon); + c = adu_per_photon * poisson_noise(rng, val/adu_per_photon); set_intensity(refl, c); } + + gsl_rng_free(rng); } |