Index: trunk/SophyaLib/BaseTools/srandgen.h
===================================================================
--- trunk/SophyaLib/BaseTools/srandgen.h	(revision 3597)
+++ trunk/SophyaLib/BaseTools/srandgen.h	(revision 3615)
@@ -1,5 +1,5 @@
-/* fonctions pour generateurs aleatoires     */
-/*                         cmv  23/06/94     */
-/*  R.Ansari 04/2000  Copie de nbrand.h .c   */
+/* fonctions pour generateurs aleatoires  cmv 23/06/94 */
+/*  Copie de nbrand.h .c  .Ansari 04/2000              */
+/* interface avec RandomGeneratorInterface cmv 04/2009 */
 
 #ifndef SRANDGEN_H_SEEN
@@ -8,80 +8,47 @@
 #include "machdefs.h"
 #include <stdlib.h>
+#include <complex>
+#include "randinterf.h"
 
-/* ------- SPECIFIQUE Mac Darwin OSX  <= 10.2 (gcc < 3.x) -------- */
-#if defined(Darwin) &&  defined(__GNUC__) && (__GNUC__ < 3)
-#include "osx_values.h"
-/* Declaration de drand48 et srand48 etc , mis ds SysSpec 
-                                          Reza 11/02/2003 */
-#ifdef __cplusplus
-extern "C" {
-#endif
-unsigned short int * seed48(unsigned short int seed16v[3]);
-void srand48(long seedval);
-/* Faute de mieux pour le moment : */
-#ifdef __cplusplus
-}
-#endif
-#define drand48() ((double)(random())/LONG_MAX)
-#endif
-/* ------- FIN SPECIFIQUE Mac OSX / Darwin V <= 10.2 --------- */
+/* Declaration en fonctions inline interface avec RandomGeneratorInterface global*/
 
-#ifdef __cplusplus
-/* Declaration en fonctions inlines pour du C++ */
-inline float frand01() { return ( (float) drand48() ); }
-inline double drand01() { return ( drand48() ); }
-inline double ranf01() { return ( drand48() ); }
+namespace SOPHYA {
 
-inline float frandpm1() { return ( 2. * (float) drand48()  - 1.); }
-inline double drandpm1() { return ( 2. * drand48() - 1.); }
-inline double ranfpm1() { return ( 2. * drand48() - 1.); }
-#else
-/* les memes en define pour du C */
-#define frand01() ( (float) drand48() )
-#define drand01() ( drand48() )
-#define ranf01() drand01()
 
-#define frandpm1() ( 2. * frand01() - 1.)
-#define drandpm1() ( 2. * drand01() - 1.)
-#define ranfpm1() drandpm1()
-#endif
+inline double drand01() 
+  {return RandomGeneratorInterface::GetGlobalRandGenP()->Flat01();}
+inline double drandpm1() 
+  {return RandomGeneratorInterface::GetGlobalRandGenP()->Flatpm1();}
 
-struct tirage_alea {
-  int Nbin;
-  double Min,Max,Lbin;
-  double *Tab;
-};
-typedef struct tirage_alea TIREALEA;
+inline double NorRand() 
+  {return RandomGeneratorInterface::GetGlobalRandGenP()->Gaussian();}
+inline double Gaussian(double sigma,double mu) 
+  {return RandomGeneratorInterface::GetGlobalRandGenP()->Gaussian(sigma,mu);}
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+inline complex< r_8 > ComplexGaussian()
+  {return RandomGeneratorInterface::GetGlobalRandGenP()->ComplexGaussian();}
+inline complex< r_8 > ComplexGaussian(double sig)
+  {return RandomGeneratorInterface::GetGlobalRandGenP()->ComplexGaussian(sig);}
+inline double ModComplexGaussian(double sig=1.)
+  {return RandomGeneratorInterface::GetGlobalRandGenP()->ModComplexGaussian(sig);}
 
-void Ini_Ranf_Quick(long seed_val, int lp);
-void Ini_Ranf(unsigned short seed_16v[3], int lp);
-void Get_Ranf(unsigned short seed_16v[3], int lp);
-void Auto_Ini_Ranf(int lp);
+inline double Poisson(double mu, double mumax=-1) 
+  {return RandomGeneratorInterface::GetGlobalRandGenP()->Poisson(mu,mumax);}
 
-void SetGauRange(double range);
-double NorRand1(void);
-double GauRnd1(double am, double s);
-double NorRand(void);
-double GauRnd(double am, double s);
-int NormCo(double *a,double *b
-          ,double mx,double my,double sx,double sy,double ro);
-void NormGau(double *x,double *y
-            ,double mx,double my,double sa,double sb,double teta);
+inline double Exponential() 
+  {return RandomGeneratorInterface::GetGlobalRandGenP()->Exponential();}
 
-int PoissRand(double mu);
-unsigned long PoissRandLimit(double mu,double mumax /* =10. */ );
+inline int Gaussian2DRho(double &x,double &y,double mx,double my,double sx,double sy,double ro)
+  {return RandomGeneratorInterface::GetGlobalRandGenP()->Gaussian2DRho(x,y,mx,my,sx,sy,ro);}
+inline void Gaussian2DAng(double &x,double &y,double mx,double my,double sa,double sb,double teta)
+  {return RandomGeneratorInterface::GetGlobalRandGenP()->Gaussian2DAng(x,y,mx,my,sa,sb,teta);}
 
-TIREALEA *init_tirage_alea(int nbin,double xmin,double xmax,double (*fonc) (double));
-double tirage_alea(TIREALEA *alea);
-int end_tirage_alea(TIREALEA *alea);
+inline void AutoInitRand(int lp)
+  {return RandomGeneratorInterface::GetGlobalRandGenP()->AutoInit(lp);}
 
-#ifdef __cplusplus
-}
-#endif
+inline void ShowRandom()
+  {return RandomGeneratorInterface::GetGlobalRandGenP()->ShowRandom();}
+
+}  /* namespace SOPHYA */
 
 #endif
-
