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

Last change on this file since 4018 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
RevLine 
[3615]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 */
[851]4
5#ifndef SRANDGEN_H_SEEN
6#define SRANDGEN_H_SEEN
7
8#include "machdefs.h"
9#include <stdlib.h>
[3615]10#include <complex>
11#include "randinterf.h"
[851]12
[3615]13/* Declaration en fonctions inline interface avec RandomGeneratorInterface global*/
[2323]14
[3615]15namespace SOPHYA {
[3099]16
[851]17
[3615]18inline double drand01()
19 {return RandomGeneratorInterface::GetGlobalRandGenP()->Flat01();}
20inline double drandpm1()
21 {return RandomGeneratorInterface::GetGlobalRandGenP()->Flatpm1();}
[851]22
[3615]23inline double NorRand()
24 {return RandomGeneratorInterface::GetGlobalRandGenP()->Gaussian();}
[3616]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)
[3615]30 {return RandomGeneratorInterface::GetGlobalRandGenP()->Gaussian(sigma,mu);}
[851]31
[4018]32 inline double GaussianTailRand(double sdev,double slim=1.)
33 {return RandomGeneratorInterface::GetGlobalRandGenP()->GaussianTail(sdev,slim);}
34
[3616]35inline complex< r_8 > ComplexGaussianRand()
[3615]36 {return RandomGeneratorInterface::GetGlobalRandGenP()->ComplexGaussian();}
[3616]37inline complex< r_8 > ComplexGaussianRand(double sig)
[3615]38 {return RandomGeneratorInterface::GetGlobalRandGenP()->ComplexGaussian(sig);}
[3616]39inline double ModComplexGaussianRand(double sig=1.)
[3615]40 {return RandomGeneratorInterface::GetGlobalRandGenP()->ModComplexGaussian(sig);}
[851]41
[3616]42inline double PoissonRand(double mu, double mumax=-1)
[3615]43 {return RandomGeneratorInterface::GetGlobalRandGenP()->Poisson(mu,mumax);}
[851]44
[3616]45inline double ExponentialRand()
[3615]46 {return RandomGeneratorInterface::GetGlobalRandGenP()->Exponential();}
[851]47
[3616]48inline int Gaussian2DRhoRand(double &x,double &y,double mx,double my,double sx,double sy,double ro)
[3615]49 {return RandomGeneratorInterface::GetGlobalRandGenP()->Gaussian2DRho(x,y,mx,my,sx,sy,ro);}
[3616]50inline void Gaussian2DAngRand(double &x,double &y,double mx,double my,double sa,double sb,double teta)
[3615]51 {return RandomGeneratorInterface::GetGlobalRandGenP()->Gaussian2DAng(x,y,mx,my,sa,sb,teta);}
[3099]52
[3615]53inline void AutoInitRand(int lp)
54 {return RandomGeneratorInterface::GetGlobalRandGenP()->AutoInit(lp);}
[851]55
[3615]56inline void ShowRandom()
57 {return RandomGeneratorInterface::GetGlobalRandGenP()->ShowRandom();}
[851]58
[3615]59} /* namespace SOPHYA */
60
[851]61#endif
Note: See TracBrowser for help on using the repository browser.