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. --- tests/gpu_sim_check.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'tests/gpu_sim_check.c') diff --git a/tests/gpu_sim_check.c b/tests/gpu_sim_check.c index c183a2a2..d2475213 100644 --- a/tests/gpu_sim_check.c +++ b/tests/gpu_sim_check.c @@ -3,7 +3,11 @@ * * Check that GPU simulation agrees with CPU version * - * Copyright © 2012 Thomas White + * Copyright © 2012-2014 Deutsches Elektronen-Synchrotron DESY, + * a research centre of the Helmholtz Association. + * + * Authors: + * 2012-2014 Thomas White * * This file is part of CrystFEL. * @@ -80,6 +84,9 @@ int main(int argc, char *argv[]) double start, end; double gpu_time, cpu_time; SymOpList *sym; + gsl_rng *rng; + + rng = gsl_rng_alloc(gsl_rng_mt19937); gctx = setup_gpu(1, NULL, NULL, NULL, 0); if ( gctx == NULL ) { @@ -90,7 +97,7 @@ int main(int argc, char *argv[]) cell_raw = cell_new_from_parameters(28.1e-9, 28.1e-9, 16.5e-9, deg2rad(90.0), deg2rad(90.0), deg2rad(120.0)); - cell = cell_rotate(cell_raw, random_quaternion()); + cell = cell_rotate(cell_raw, random_quaternion(rng)); gpu_image.width = 1024; gpu_image.height = 1024; @@ -217,5 +224,7 @@ int main(int argc, char *argv[]) } + gsl_rng_free(rng); + return 0; } -- cgit v1.2.3