aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2009-12-04 15:31:43 +0100
committerThomas White <taw@physics.org>2009-12-04 15:31:43 +0100
commit550acac3992f5b5aa2d162ed215ddd3359588450 (patch)
treecb9334ab144498f197b4b0ba5885c08fe317f326
parent1e39bf6a4886194476f2c8cedac1814b3f53e6e1 (diff)
Fix rotation group sampling. D'oh.
-rw-r--r--src/utils.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/utils.c b/src/utils.c
index f27b1228..5942299d 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -122,10 +122,10 @@ struct quaternion random_quaternion()
{
struct quaternion q;
- q.w = (double)random()/RAND_MAX;
- q.x = (double)random()/RAND_MAX;
- q.y = (double)random()/RAND_MAX;
- q.z = (double)random()/RAND_MAX;
+ q.w = 2.0*(double)random()/RAND_MAX - 1.0;
+ q.x = 2.0*(double)random()/RAND_MAX - 1.0;
+ q.y = 2.0*(double)random()/RAND_MAX - 1.0;
+ q.z = 2.0*(double)random()/RAND_MAX - 1.0;
q = normalise_quaternion(q);
return q;