From d45d3e765011f99bd84bf52872590a4d8ff89ac7 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 21 Jul 2021 14:12:19 +0200 Subject: Fix random_partiality() --- libcrystfel/src/geometry.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'libcrystfel/src') diff --git a/libcrystfel/src/geometry.c b/libcrystfel/src/geometry.c index e847711d..ff6d14c7 100644 --- a/libcrystfel/src/geometry.c +++ b/libcrystfel/src/geometry.c @@ -194,47 +194,46 @@ double gaussian_fraction(double rlow, double rhigh, double R) } +static void reseed(gsl_rng *rng) +{ + unsigned long int seed = gsl_rng_get(rng); + gsl_rng_set(rng, seed); +} + + static double random_partiality(signed int h, signed int k, signed int l, int serial) { gsl_rng *rng = gsl_rng_alloc(gsl_rng_mt19937); - unsigned long int seed; double p; int i; gsl_rng_set(rng, serial); - seed = gsl_rng_get(rng); - gsl_rng_set(rng, seed); + reseed(rng); for ( i=0; i= 0 ) { - seed = gsl_rng_get(rng); + reseed(rng); } - seed = gsl_rng_get(rng); - gsl_rng_set(rng, seed); for ( i=0; i= 0 ) { - seed = gsl_rng_get(rng); + reseed(rng); } - seed = gsl_rng_get(rng); - gsl_rng_set(rng, seed); for ( i=0; i= 0 ) { - seed = gsl_rng_get(rng); + reseed(rng); } - seed = gsl_rng_get(rng); - gsl_rng_set(rng, seed); p = gsl_rng_uniform(rng); gsl_rng_free(rng); -- cgit v1.2.3