X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fmodules%2Fmod_noise%2Frandom.cpp;h=d84f97e78e8dc2f14b8cf9b01d053b1a9d5dc619;hb=c25902b514d64fd65c96ed56171bcd205d19d699;hp=a5750dfb52f8e964004eb236ed1cc9187d977352;hpb=5ddcf36f04cfbd10fabda4e3c5633cb27cdd4c0a;p=synfig.git diff --git a/synfig-core/trunk/src/modules/mod_noise/random.cpp b/synfig-core/trunk/src/modules/mod_noise/random.cpp index a5750df..d84f97e 100644 --- a/synfig-core/trunk/src/modules/mod_noise/random.cpp +++ b/synfig-core/trunk/src/modules/mod_noise/random.cpp @@ -1,8 +1,8 @@ /* === S Y N F I G ========================================================= */ -/*! \file noise.cpp +/*! \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 @@ -30,43 +30,11 @@ #endif #include "random.h" +#include #include #include #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 +146,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);