home *** CD-ROM | disk | FTP | other *** search
- // FlRandom.cpp: implementation of the FlRandom class.
- //
- //////////////////////////////////////////////////////////////////////
-
- #include "FlRandom.h"
-
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
-
- FlRandom::FlRandom()
- {
- // Initialize random generator variables
- randx = 1;
- z = (double) 0x7fffffff;
- }
-
- FlRandom::~FlRandom()
- {
-
- }
-
- /* Pseudo-random generator */
- long FlRandom::Random(long L, long H)
- {
- long i,j;
- double x;
-
- randx = (randx * 1103515245) + 12345;
- i = randx & 0x7ffffffe;
- x = ((double) i) / z;
- x *= (L+H+1);
- j = (long)x;
- return j-L;
- }