From 90ee3c269580104f2d16d28aeaa565063f6fc1f2 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 17 Jan 2014 16:52:57 +0100 Subject: RNG overhaul Previously, we were using random(), which is really really bad. --- src/get_hkl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/get_hkl.c') 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); } -- cgit v1.2.3