[220] | 1 | // This may look like C code, but it is really -*- C++ -*-
|
---|
| 2 | // Nombres aleatoires pour Peida.
|
---|
[3600] | 3 | // C. Magneville 1996-2000
|
---|
[1371] | 4 | // DAPNIA/SPP (Saclay) / CEA LAL - IN2P3/CNRS (Orsay)
|
---|
[220] | 5 |
|
---|
| 6 | #ifndef PERANDOM_SEEN
|
---|
| 7 | #define PERANDOM_SEEN
|
---|
| 8 |
|
---|
[244] | 9 | #include "machdefs.h"
|
---|
[220] | 10 | #include <stdlib.h>
|
---|
[3097] | 11 | #include <math.h>
|
---|
[3608] | 12 | #include "tvector.h"
|
---|
[220] | 13 | #include "histos.h"
|
---|
[3109] | 14 | #include "classfunc.h"
|
---|
[220] | 15 |
|
---|
[1371] | 16 | namespace SOPHYA {
|
---|
| 17 |
|
---|
[220] | 18 | class FunRan : public Histo {
|
---|
| 19 | public:
|
---|
[1092] | 20 | typedef r_8 (*Func)(r_8);
|
---|
[3109] | 21 | FunRan(ClassFunc& f, r_8 xMin=0.0, r_8 xMax=1.0, int_4 nBin=100, bool pdf=true);
|
---|
| 22 | FunRan(Func f, r_8 xMin=0.0, r_8 xMax=1.0, int_4 nBin=100, bool pdf=true);
|
---|
| 23 | FunRan(r_8 *tab, int_4 nBin, bool pdf=true);
|
---|
| 24 | FunRan(r_8 *tab, int_4 nBin, r_8 xMin, r_8 xMax, bool pdf=true);
|
---|
[3608] | 25 | FunRan(TVector<r_8>& tab, bool pdf=true);
|
---|
| 26 | FunRan(TVector<r_8>& tab, r_8 xMin, r_8 xMax, bool pdf=true);
|
---|
[2840] | 27 | FunRan(Histo &h, bool pdf=true);
|
---|
[3321] | 28 | FunRan(const FunRan& fh);
|
---|
| 29 | FunRan(void);
|
---|
| 30 |
|
---|
[3109] | 31 | int_4 BinRandom(void);
|
---|
[1092] | 32 | r_8 Random(void);
|
---|
[3109] | 33 | r_8 RandomInterp(void);
|
---|
| 34 | protected:
|
---|
| 35 | void create_DF(bool pdf);
|
---|
[220] | 36 | };
|
---|
| 37 |
|
---|
[1371] | 38 | class FunRan2D {
|
---|
[220] | 39 | public:
|
---|
[1092] | 40 | // typedef r_8 (*Func)(r_8, r_8);
|
---|
| 41 | // FunRan2D(Func f, r_8 xMin=0.0, r_8 xMax=1.0, int_4 nBinX=100,
|
---|
| 42 | // r_8 yMin=0.0, r_8 yMax=1.0, int_4 nBinY=100);
|
---|
| 43 | FunRan2D(r_8 *tab, int_4 nBinX, int_4 nBinY);
|
---|
| 44 | FunRan2D(r_8 **tab, int_4 nBinX, int_4 nBinY);
|
---|
[220] | 45 | ~FunRan2D();
|
---|
[1092] | 46 | void Random(r_8& x, r_8& y);
|
---|
| 47 | void BinRandom(int_4& x, int_4& y);
|
---|
[220] | 48 | private:
|
---|
| 49 | FunRan* ranX;
|
---|
| 50 | FunRan** ranY;
|
---|
[1092] | 51 | int_4 nx;
|
---|
[220] | 52 | };
|
---|
| 53 |
|
---|
[1371] | 54 | } // namespace SOPHYA
|
---|
| 55 |
|
---|
[220] | 56 | #endif
|
---|