/* fonctions pour generateurs aleatoires */
/*                         cmv  23/06/94 */

#ifndef NBRANDOM_H_SEEN
#define NBRANDOM_H_SEEN

#include "machdefs.h"
#include <stdlib.h>
#ifdef __MWERKS__
   #include "mwerksmath.h"
   #include "unixmac.h"
#endif

#define frand01() ( (float) drand48() )
#define drand01() ( drand48() )
#define ranf01() drand01()

#define frandpm1() ( 2. * frand01() - 1.)
#define drandpm1() ( 2. * drand01() - 1.)
#define ranfpm1() drandpm1()

struct tirage_alea {
  int Nbin;
  double Min,Max,Lbin;
  double *Tab;
};
typedef struct tirage_alea TIREALEA;

#ifdef __cplusplus
extern "C" {
#endif

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);

void SetGauRange(double range);
float NorRand1(void);
double GauRnd1(double am, double s);
float 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);

TIREALEA *init_tirage_alea(int nbin,double xmin,double xmax,double (*fonc) (double));
double tirage_alea(TIREALEA *alea);
int end_tirage_alea(TIREALEA *alea);

#ifdef __cplusplus
}
#endif

#endif

