[Avida-SVN] r1165 - development/source/main

brysonda at myxo.css.msu.edu brysonda at myxo.css.msu.edu
Wed Jan 3 10:50:37 PST 2007


Author: brysonda
Date: 2007-01-03 13:50:36 -0500 (Wed, 03 Jan 2007)
New Revision: 1165

Modified:
   development/source/main/cEnvironment.cc
Log:
Ensure that standard environments properly initialize all bits for inputs greater than the standard 3.

Modified: development/source/main/cEnvironment.cc
===================================================================
--- development/source/main/cEnvironment.cc	2007-01-03 18:39:10 UTC (rev 1164)
+++ development/source/main/cEnvironment.cc	2007-01-03 18:50:36 UTC (rev 1165)
@@ -741,13 +741,13 @@
       }
     } else {
       // Set the top 8 bits of the input buffer...
-      input_array[0] = 15 << 24;  // 00001111
-      input_array[1] = 51 << 24;  // 00110011
-      input_array[2] = 85 << 24;  // 01010101
-      
+      input_array[0] = (15 << 24) + ctx.GetRandom().GetUInt(1 << 24);  // 00001111
+      input_array[1] = (51 << 24) + ctx.GetRandom().GetUInt(1 << 24);  // 00110011
+      input_array[2] = (85 << 24) + ctx.GetRandom().GetUInt(1 << 24);  // 01010101
+
       // And randomize the rest...
-      for (int i = 0; i < m_input_size; i++) {
-        input_array[i] += ctx.GetRandom().GetUInt(1 << 24);
+      for (int i = 3; i < m_input_size; i++) {
+        input_array[i] = ctx.GetRandom().GetUInt(1 << 24);
       }
     }
   } else {




More information about the Avida-cvs mailing list