]>
Commit | Line | Data |
---|---|---|
0ca57c2f | 1 | #ifndef _PhotosRandom_included_ |
2 | #define _PhotosRandom_included_ | |
3 | ||
4 | /** | |
5 | * @class PhotosRandom | |
6 | * | |
7 | * @brief Photos random number generator rewritten from PHOTOS FORTRAN | |
8 | * | |
9 | * Generates uniformly distributed random numbers between 0 and 1. | |
10 | * Must be initialized by call to PhotosRandom::initialize(). | |
11 | * Original authors: B. van Eijk, F. James, G. Marsaglia and A. Zaman | |
12 | * | |
13 | * @author Tomasz Przedzinski | |
14 | * @date 18th October 2010 | |
15 | */ | |
16 | ||
17 | namespace Photospp | |
18 | { | |
19 | ||
20 | class PhotosRandom | |
21 | { | |
22 | public: | |
23 | /* Change the seed. Default is s1=1802 and s2=9373 | |
24 | These values must be in range [0,31327] and [0,30080] respectively */ | |
25 | static void setSeed(int s1,int s2); | |
26 | ||
27 | /* Initialization routine. Must be called at least once before | |
28 | the generator can be used. */ | |
29 | static void initialize(); | |
30 | ||
31 | /* Uniform distribution between 0 and 1 */ | |
32 | static double randomReal(); | |
33 | ||
34 | protected: | |
35 | static bool init; | |
36 | static int iseed[2]; | |
37 | static int i97; | |
38 | static int j97; | |
39 | static double uran[97]; | |
40 | static double cran; | |
41 | static const double cdran; | |
42 | static const double cmran; | |
43 | }; | |
44 | ||
45 | } // namespace Photospp | |
46 | #endif |