[Avida-cvs] [avida-svn] r1019 - trunk/source/tools

brysonda at myxo.css.msu.edu brysonda at myxo.css.msu.edu
Fri Sep 29 16:57:09 PDT 2006


Author: brysonda
Date: 2006-09-29 19:57:09 -0400 (Fri, 29 Sep 2006)
New Revision: 1019

Modified:
   trunk/source/tools/cRandom.h
Log:
Update cRandom.h to specify explicitly the order in which the casting should occur. Improper casting order was causing organism replication to fail (among probably many other things), in trunk.

Modified: trunk/source/tools/cRandom.h
===================================================================
--- trunk/source/tools/cRandom.h	2006-09-29 22:10:53 UTC (rev 1018)
+++ trunk/source/tools/cRandom.h	2006-09-29 23:57:09 UTC (rev 1019)
@@ -126,7 +126,7 @@
    * @return The pseudo random number.
    * @param max The upper bound for the random numbers (will never be returned).
    **/
-  unsigned int GetUInt(const unsigned int max) { return static_cast<unsigned int>(GetDouble()) * max; }
+  unsigned int GetUInt(const unsigned int max) { return static_cast<unsigned int>(GetDouble() * static_cast<double>(max)); }
   
   /**
    * Generate an unsigned int out of an interval.




More information about the Avida-cvs mailing list