[Avida-cvs] [avida-svn] r1018 - development/source/tools

brysonda at myxo.css.msu.edu brysonda at myxo.css.msu.edu
Fri Sep 29 15:10:53 PDT 2006


Author: brysonda
Date: 2006-09-29 18:10:53 -0400 (Fri, 29 Sep 2006)
New Revision: 1018

Modified:
   development/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).

Modified: development/source/tools/cRandom.h
===================================================================
--- development/source/tools/cRandom.h	2006-09-29 19:26:10 UTC (rev 1017)
+++ development/source/tools/cRandom.h	2006-09-29 22:10:53 UTC (rev 1018)
@@ -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<int>(GetDouble()) * max; }
+  unsigned int GetUInt(const unsigned int max) { return static_cast<int>(GetDouble() * static_cast<double>(max)); }
   
   /**
    * Generate an unsigned int out of an interval.




More information about the Avida-cvs mailing list