Add my copyright to files I've modified.
[synfig.git] / synfig-core / trunk / src / modules / mod_noise / random.cpp
index a203353..a77de36 100644 (file)
@@ -2,10 +2,11 @@
 /*!    \file mod_noise/random.cpp
 **     \brief blehh
 **
-**     $Id: random.cpp,v 1.6 2005/01/17 02:00:19 darco Exp $
+**     $Id$
 **
 **     \legal
 **     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2007 Chris Moore
 **
 **     This package is free software; you can redistribute it and/or
 **     modify it under the terms of the GNU General Public License as
 #endif
 
 #include "random.h"
+#include <synfig/quick_rng.h>
 #include <cmath>
 #include <cstdlib>
 #endif
 
-// A fast 32-bit linear congruential random number generator
-class quick_rng
-{
-       unsigned long next;
-public:
-       quick_rng(unsigned long seed):next(seed) { }
-
-       void set_seed(unsigned long x)
-       {
-               next=x;
-       }
-
-       unsigned long i32()
-       {
-               static const unsigned long a(1664525);
-               static const unsigned long c(1013904223);
-
-               return next=next*a+c;
-       }
-
-       unsigned long i16()
-       {
-               return i32()>>16;
-       }
-
-       float f()
-       {
-               static const float m(int(65535));
-
-               return float(i16())/m;
-       }
-};
-
 /* === M A C R O S ========================================================= */
 
 #define PI     (3.1415927)
@@ -178,8 +147,8 @@ Random::operator()(int smooth,int subseed,float xf,float yf,float tf)const
 #define FT(i,j,k)      ((*this)(subseed,i+x,j+y,k+t)*(R((i)-a)*R(b-(j))*R((k)-c)))
 #define Z(i,j) ret+=F(i,j)
 #define ZT(i,j,k) ret+=FT(i,j,k)
-#define X(i,j) // placeholder... To make box more symetric
-#define XT(i,j,k)      // placeholder... To make box more symetric
+#define X(i,j) // placeholder... To make box more symmetric
+#define XT(i,j,k)      // placeholder... To make box more symmetric
 
                float a(xf-x), b(yf-y);