source: Sophya/trunk/SophyaLib/NTools/perandom.h@ 4034

Last change on this file since 4034 was 3615, checked in by cmv, 16 years ago

Modifs relatives a l'introduction de RandomGeneratorInterface + delete de srandgen.c, cmv 01/05/2009

File size: 1.4 KB
Line 
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
16namespace SOPHYA {
17
18class FunRan : public Histo {
19public:
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);
34protected:
35 void create_DF(bool pdf);
36};
37
38class FunRan2D {
39public:
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);
48private:
49 FunRan* ranX;
50 FunRan** ranY;
51 int_4 nx;
52};
53
54} // namespace SOPHYA
55
56#endif
Note: See TracBrowser for help on using the repository browser.