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

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