PhotosRandom.h

00001 #ifndef _PhotosRandom_included_
00002 #define _PhotosRandom_included_
00003 
00004 /**
00005  * @class PhotosRandom
00006  *
00007  * @brief Photos random number generator rewritten from PHOTOS FORTRAN
00008  *
00009  * Generates uniformly distributed random numbers between 0 and 1.
00010  * Must be initialized by call to PhotosRandom::initialize().
00011  * Original authors: B. van Eijk, F. James, G. Marsaglia and A. Zaman
00012  *
00013  * @author Tomasz Przedzinski
00014  * @date 18th October 2010
00015  */
00016 
00017 namespace Photospp
00018 {
00019 
00020 class PhotosRandom
00021 {
00022 public:
00023         /* Change the seed. Default is s1=1802 and s2=9373
00024            These values must be in range [0,31327] and [0,30080] respectively */
00025         static void setSeed(int s1,int s2);
00026 
00027         /* Initialization routine. Must be called at least once before
00028            the generator can be used. */
00029         static void initialize();
00030 
00031         /* Uniform distribution between 0 and 1 */
00032         static double randomReal();
00033 
00034 protected:
00035         static bool init;
00036         static int iseed[2];
00037         static int i97;
00038         static int j97;
00039         static double uran[97];
00040         static double cran;
00041         static const double cdran;
00042         static const double cmran;
00043 };
00044 
00045 } // namespace Photospp
00046 #endif
Generated on Sun Oct 20 20:23:56 2013 for C++InterfacetoPHOTOS by  doxygen 1.6.3