Manta Interactive Ray Tracer Development Mailing List

Text archives Help


Re: [Manta] r1918 - trunk/Core/Math


Chronological Thread 
  • From: James Bigler <bigler@cs.utah.edu>
  • Cc: manta@sci.utah.edu
  • Subject: Re: [Manta] r1918 - trunk/Core/Math
  • Date: Wed, 12 Dec 2007 06:33:45 -0700

Do you have any examples of where we create a CheapRNG, but don't call seed()?

James

On Dec 11, 2007, at 8:22 PM, thiago@sci.utah.edu wrote:

Author: thiago
Date: Tue Dec 11 20:22:04 2007
New Revision: 1918

Modified:
   trunk/Core/Math/CheapRNG.h
Log:
seed wasn't being called which resulted in an uninitialized value
for val. This caused tons of warnings in valgrind. It also meant
that val_see remained uninitialized and possibly contained the same
4 values. If you don't want create() to call seed, then make sure
seed is called somewhere else!

Modified: trunk/Core/Math/CheapRNG.h
====================================================================== ========
--- trunk/Core/Math/CheapRNG.h  (original)
+++ trunk/Core/Math/CheapRNG.h  Tue Dec 11 20:22:04 2007
@@ -79,7 +79,10 @@
   public:
     // Your seed value is up to the fates.  You should call seed.
     CheapRNG() {}
- static void create(RandomNumberGenerator*& rng ) { rng = new CheapRNG(); }
+    static void create(RandomNumberGenerator*& rng ) {
+      rng = new CheapRNG();
+      rng->seed(0);
+    }

     virtual void seed(unsigned int seed_val) {
       val = seed_val;






Archive powered by MHonArc 2.6.16.

Top of page