[patch] Re: [ODE] rand vs dRand

Adam D. Moss adam at gimp.org
Wed Apr 28 18:34:22 MST 2004


I'd be grateful if stepfast users could try this trivial patch out
before I commit it.  dRandInt's random numbers aren't as good
as a modern rand()'s, but I suspect that no application would
be able to demonstrate a qualitative difference in the resulting
simulation... my testing couldn't.
--Adam
-- 
Adam D. Moss   . ,,^^   adam at gimp.org   http://www.foxbox.org/   co:3
-------------- next part --------------
Index: vendor/ode/ode/src/stepfast.cpp
===================================================================
--- vendor/ode/ode/src/stepfast.cpp	(revision 1866)
+++ vendor/ode/ode/src/stepfast.cpp	(working copy)
@@ -37,6 +37,7 @@
 #include <ode/timer.h>
 #include <ode/error.h>
 #include <ode/matrix.h>
+#include <ode/misc.h>
 #include "lcp.h"
 #include "step.h"
 
@@ -824,7 +825,7 @@
 			joint = joints[j];
 			dxJoint::Info1 i1 = info[j];
 			dxJoint::Info2 i2 = Jinfo[j];
-			int r = rand () % (j + 1);
+                        const int r = dRandInt(j+1);
 			joints[j] = joints[r];
 			info[j] = info[r];
 			Jinfo[j] = Jinfo[r];


More information about the ODE mailing list