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