aboutsummaryrefslogtreecommitdiff
path: root/tests/cell_check.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2014-01-17 16:52:57 +0100
committerThomas White <taw@physics.org>2014-01-20 17:20:14 +0100
commit90ee3c269580104f2d16d28aeaa565063f6fc1f2 (patch)
treebd3c69f932648dc6fb01e4cce69bd27fb4831be2 /tests/cell_check.c
parent8e2f2f44f46c18f7bd621a2ef9a3d0aa813d76d9 (diff)
RNG overhaul
Previously, we were using random(), which is really really bad.
Diffstat (limited to 'tests/cell_check.c')
-rw-r--r--tests/cell_check.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/cell_check.c b/tests/cell_check.c
index f62cd7be..009b4c1f 100644
--- a/tests/cell_check.c
+++ b/tests/cell_check.c
@@ -3,7 +3,11 @@
*
* Check that unit cells work correctly
*
- * Copyright © 2012 Thomas White <taw@physics.org>
+ * Copyright © 2012-2014 Deutsches Elektronen-Synchrotron DESY,
+ * a research centre of the Helmholtz Association.
+ *
+ * Authors:
+ * 2012-2014 Thomas White <taw@physics.org>
*
* This file is part of CrystFEL.
*
@@ -49,6 +53,9 @@ int main(int argc, char *argv[])
double ax, ay, az;
double bx, by, bz;
double cx, cy, cz;
+ gsl_rng *rng;
+
+ rng = gsl_rng_alloc(gsl_rng_mt19937);
cell = cell_new_from_parameters(27.155e-9, 28.155e-9, 10.987e-9,
deg2rad(90.0),
@@ -56,7 +63,7 @@ int main(int argc, char *argv[])
deg2rad(120.0));
if ( cell == NULL ) return 1;
- orientation = random_quaternion();
+ orientation = random_quaternion(rng);
cell = cell_rotate(cell, orientation);
cell_get_reciprocal(cell, &asx, &asy, &asz,
@@ -112,6 +119,7 @@ int main(int argc, char *argv[])
cx, cy, cz);
cell_print(cell);
+ gsl_rng_free(rng);
return fail;
}