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. --- libcrystfel/src/utils.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'libcrystfel/src/utils.h') diff --git a/libcrystfel/src/utils.h b/libcrystfel/src/utils.h index f4477717..81270916 100644 --- a/libcrystfel/src/utils.h +++ b/libcrystfel/src/utils.h @@ -3,11 +3,11 @@ * * Utility stuff * - * Copyright © 2012 Deutsches Elektronen-Synchrotron DESY, - * a research centre of the Helmholtz Association. + * Copyright © 2012-2014 Deutsches Elektronen-Synchrotron DESY, + * a research centre of the Helmholtz Association. * * Authors: - * 2009-2012 Thomas White + * 2009-2014 Thomas White * * This file is part of CrystFEL. * @@ -40,6 +40,7 @@ #include #include #include +#include #include "thread-pool.h" @@ -89,7 +90,7 @@ struct quaternion { extern struct quaternion normalise_quaternion(struct quaternion q); extern double quaternion_modulus(struct quaternion q); -extern struct quaternion random_quaternion(void); +extern struct quaternion random_quaternion(gsl_rng *rng); extern int quaternion_valid(struct quaternion q); extern struct rvec quat_rot(struct rvec q, struct quaternion z); @@ -114,10 +115,10 @@ extern int assplode(const char *a, const char *delims, char ***pbits, AssplodeFlag flags); extern void progress_bar(int val, int total, const char *text); -extern double random_flat(double max); -extern double flat_noise(double expected, double width); -extern double gaussian_noise(double expected, double stddev); -extern int poisson_noise(double expected); +extern double random_flat(gsl_rng *rng, double max); +extern double flat_noise(gsl_rng *rng, double expected, double width); +extern double gaussian_noise(gsl_rng *rng, double expected, double stddev); +extern int poisson_noise(gsl_rng *rng, double expected); /* Keep these ones inline, to avoid function call overhead */ static inline struct quaternion invalid_quaternion(void) -- cgit v1.2.3