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

Last change on this file since 3616 was 3616, checked in by cmv, 16 years ago
  • sorties de leur contexte de methode de classe, les inline globaux des fonctions aleatoires avaient un nom pas adapte:

Gaussian ComplexGaussian Exponential ne permettent pas de savoir
si il s'agit de la fonction ou de la distribution,
ACTION:
Gaussian -> GaussianRand
ComplexGaussian -> ComplexGaussianRand
Poisson -> PoissonRand
Exponential -> ExponentialRand

+ propagation dans le code Sophya. cmv 02/05/2009

File size: 2.3 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
32inline complex< r_8 > ComplexGaussianRand()
33 {return RandomGeneratorInterface::GetGlobalRandGenP()->ComplexGaussian();}
34inline complex< r_8 > ComplexGaussianRand(double sig)
35 {return RandomGeneratorInterface::GetGlobalRandGenP()->ComplexGaussian(sig);}
36inline double ModComplexGaussianRand(double sig=1.)
37 {return RandomGeneratorInterface::GetGlobalRandGenP()->ModComplexGaussian(sig);}
38
39inline double PoissonRand(double mu, double mumax=-1)
40 {return RandomGeneratorInterface::GetGlobalRandGenP()->Poisson(mu,mumax);}
41
42inline double ExponentialRand()
43 {return RandomGeneratorInterface::GetGlobalRandGenP()->Exponential();}
44
45inline int Gaussian2DRhoRand(double &x,double &y,double mx,double my,double sx,double sy,double ro)
46 {return RandomGeneratorInterface::GetGlobalRandGenP()->Gaussian2DRho(x,y,mx,my,sx,sy,ro);}
47inline void Gaussian2DAngRand(double &x,double &y,double mx,double my,double sa,double sb,double teta)
48 {return RandomGeneratorInterface::GetGlobalRandGenP()->Gaussian2DAng(x,y,mx,my,sa,sb,teta);}
49
50inline void AutoInitRand(int lp)
51 {return RandomGeneratorInterface::GetGlobalRandGenP()->AutoInit(lp);}
52
53inline void ShowRandom()
54 {return RandomGeneratorInterface::GetGlobalRandGenP()->ShowRandom();}
55
56} /* namespace SOPHYA */
57
58#endif
Note: See TracBrowser for help on using the repository browser.