RNG.h

Go to the documentation of this file.
00001 //===-- RNG.h ---------------------------------------------------*- C++ -*-===//
00002 //
00003 //                     The KLEE Symbolic Virtual Machine
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 
00010 #ifndef KLEE_UTIL_RNG_H
00011 #define KLEE_UTIL_RNG_H
00012 
00013 namespace klee {
00014   class RNG {
00015   private:
00016     /* Period parameters */  
00017     static const int N = 624;
00018     static const int M = 397;
00019     static const unsigned int MATRIX_A = 0x9908b0dfUL;   /* constant vector a */
00020     static const unsigned int UPPER_MASK = 0x80000000UL; /* most significant w-r bits */
00021     static const unsigned int LOWER_MASK = 0x7fffffffUL; /* least significant r bits */
00022       
00023   private:
00024     unsigned int mt[N]; /* the array for the state vector  */
00025     int mti;
00026     
00027   public:
00028     RNG(unsigned int seed=5489UL);
00029   
00030     void seed(unsigned int seed);
00031     
00032     /* generates a random number on [0,0xffffffff]-interval */
00033     unsigned int getInt32();
00034     /* generates a random number on [0,0x7fffffff]-interval */
00035     int getInt31();
00036     /* generates a random number on [0,1]-real-interval */
00037     double getDoubleLR();
00038     float getFloatLR();
00039     /* generates a random number on [0,1)-real-interval */
00040     double getDoubleL();
00041     float getFloatL();
00042     /* generates a random number on (0,1)-real-interval */
00043     double getDouble();
00044     float getFloat();
00045     /* generators a random flop */
00046     bool getBool();
00047   };
00048 }
00049 
00050 #endif

Generated on Fri Jun 5 03:31:31 2009 for klee by  doxygen 1.5.8