source: Sophya/trunk/SophyaLib/BaseTools/srandgen.h@ 4041

Last change on this file since 4041 was 4018, checked in by cmv, 14 years ago
  • introduction du tirage gaussien par la methode de la ziggurat
  • ajout argument slim par defaut dans GaussianTail pour proteger d'une reccursion infinie genere par le tirage gaussien ziggurat dans le cas ou GaussianTail applique la methode par rejection (sdev<slim)

cmv, 21/09/2011

File size: 2.4 KB
Line 
1/* fonctions pour generateurs aleatoires cmv 23/06/94 */
2/* Copie de nbrand.h .c .Ansari 04/2000 */
3/* interface avec RandomGeneratorInterface cmv 04/2009 */
4
5#ifndef SRANDGEN_H_SEEN
6#define SRANDGEN_H_SEEN
7
8#include "machdefs.h"
9#include <stdlib.h>
10#include <complex>
11#include "randinterf.h"
12
13/* Declaration en fonctions inline interface avec RandomGeneratorInterface global*/
14
15namespace SOPHYA {
16
17
18inline double drand01()
19 {return RandomGeneratorInterface::GetGlobalRandGenP()->Flat01();}
20inline double drandpm1()
21 {return RandomGeneratorInterface::GetGlobalRandGenP()->Flatpm1();}
22
23inline double NorRand()
24 {return RandomGeneratorInterface::GetGlobalRandGenP()->Gaussian();}
25inline double GaussianRand()
26 {return RandomGeneratorInterface::GetGlobalRandGenP()->Gaussian();}
27inline double GaussianRand(double sigma)
28 {return RandomGeneratorInterface::GetGlobalRandGenP()->Gaussian(sigma);}
29inline double GaussianRand(double sigma,double mu)
30 {return RandomGeneratorInterface::GetGlobalRandGenP()->Gaussian(sigma,mu);}
31
32 inline double GaussianTailRand(double sdev,double slim=1.)
33 {return RandomGeneratorInterface::GetGlobalRandGenP()->GaussianTail(sdev,slim);}
34
35inline complex< r_8 > ComplexGaussianRand()
36 {return RandomGeneratorInterface::GetGlobalRandGenP()->ComplexGaussian();}
37inline complex< r_8 > ComplexGaussianRand(double sig)
38 {return RandomGeneratorInterface::GetGlobalRandGenP()->ComplexGaussian(sig);}
39inline double ModComplexGaussianRand(double sig=1.)
40 {return RandomGeneratorInterface::GetGlobalRandGenP()->ModComplexGaussian(sig);}
41
42inline double PoissonRand(double mu, double mumax=-1)
43 {return RandomGeneratorInterface::GetGlobalRandGenP()->Poisson(mu,mumax);}
44
45inline double ExponentialRand()
46 {return RandomGeneratorInterface::GetGlobalRandGenP()->Exponential();}
47
48inline int Gaussian2DRhoRand(double &x,double &y,double mx,double my,double sx,double sy,double ro)
49 {return RandomGeneratorInterface::GetGlobalRandGenP()->Gaussian2DRho(x,y,mx,my,sx,sy,ro);}
50inline void Gaussian2DAngRand(double &x,double &y,double mx,double my,double sa,double sb,double teta)
51 {return RandomGeneratorInterface::GetGlobalRandGenP()->Gaussian2DAng(x,y,mx,my,sa,sb,teta);}
52
53inline void AutoInitRand(int lp)
54 {return RandomGeneratorInterface::GetGlobalRandGenP()->AutoInit(lp);}
55
56inline void ShowRandom()
57 {return RandomGeneratorInterface::GetGlobalRandGenP()->ShowRandom();}
58
59} /* namespace SOPHYA */
60
61#endif
Note: See TracBrowser for help on using the repository browser.