Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-27 09:20:26

0001 #ifndef _PhotosRandom_included_
0002 #define _PhotosRandom_included_
0003 
0004 /**

0005  * @class PhotosRandom

0006  *

0007  * @brief Photos random number generator rewritten from PHOTOS FORTRAN

0008  *

0009  * Generates uniformly distributed random numbers between 0 and 1.

0010  * Must be initialized by call to PhotosRandom::initialize().

0011  * Original authors: B. van Eijk, F. James, G. Marsaglia and A. Zaman

0012  *

0013  * @author Tomasz Przedzinski

0014  * @date 18th October 2010

0015  */
0016 
0017 namespace Photospp
0018 {
0019 
0020 class PhotosRandom
0021 {
0022 public:
0023     /* Change the seed. Default is s1=1802 and s2=9373

0024        These values must be in range [0,31327] and [0,30080] respectively */
0025     static void setSeed(int s1,int s2);
0026 
0027     /* Initialization routine. Must be called at least once before

0028        the generator can be used. */
0029     static void initialize();
0030 
0031     /* Uniform distribution between 0 and 1 */
0032     static double randomReal();
0033 
0034 protected:
0035     static bool init;
0036     static int iseed[2];
0037     static int i97;
0038     static int j97;
0039     static double uran[97];
0040     static double cran;
0041     static const double cdran;
0042     static const double cmran;
0043 };
0044 
0045 } // namespace Photospp

0046 #endif