| 1 | /* fonctions pour generateurs aleatoires */ | 
|---|
| 2 | /*                         cmv  23/06/94 */ | 
|---|
| 3 |  | 
|---|
| 4 | #ifndef NBRANDOM_H_SEEN | 
|---|
| 5 | #define NBRANDOM_H_SEEN | 
|---|
| 6 |  | 
|---|
| 7 | #include "machdefs.h" | 
|---|
| 8 | #include <stdlib.h> | 
|---|
| 9 | #ifdef __MWERKS__ | 
|---|
| 10 | #include "mwerksmath.h" | 
|---|
| 11 | #include "unixmac.h" | 
|---|
| 12 | #endif | 
|---|
| 13 |  | 
|---|
| 14 | #define frand01() ( (float) drand48() ) | 
|---|
| 15 | #define drand01() ( drand48() ) | 
|---|
| 16 | #define ranf01() drand01() | 
|---|
| 17 |  | 
|---|
| 18 | #define frandpm1() ( 2. * frand01() - 1.) | 
|---|
| 19 | #define drandpm1() ( 2. * drand01() - 1.) | 
|---|
| 20 | #define ranfpm1() drandpm1() | 
|---|
| 21 |  | 
|---|
| 22 | struct tirage_alea { | 
|---|
| 23 | int Nbin; | 
|---|
| 24 | double Min,Max,Lbin; | 
|---|
| 25 | double *Tab; | 
|---|
| 26 | }; | 
|---|
| 27 | typedef struct tirage_alea TIREALEA; | 
|---|
| 28 |  | 
|---|
| 29 | #ifdef __cplusplus | 
|---|
| 30 | extern "C" { | 
|---|
| 31 | #endif | 
|---|
| 32 |  | 
|---|
| 33 | void Ini_Ranf_Quick(long seed_val, int lp); | 
|---|
| 34 | void Ini_Ranf(unsigned short seed_16v[3], int lp); | 
|---|
| 35 | void Get_Ranf(unsigned short seed_16v[3], int lp); | 
|---|
| 36 | void Auto_Ini_Ranf(int lp); | 
|---|
| 37 |  | 
|---|
| 38 | void SetGauRange(double range); | 
|---|
| 39 | float NorRand1(void); | 
|---|
| 40 | double GauRnd1(double am, double s); | 
|---|
| 41 | float NorRand(void); | 
|---|
| 42 | double GauRnd(double am, double s); | 
|---|
| 43 | int NormCo(double *a,double *b | 
|---|
| 44 | ,double mx,double my,double sx,double sy,double ro); | 
|---|
| 45 | void NormGau(double *x,double *y | 
|---|
| 46 | ,double mx,double my,double sa,double sb,double teta); | 
|---|
| 47 |  | 
|---|
| 48 | TIREALEA *init_tirage_alea(int nbin,double xmin,double xmax,double (*fonc) (double)); | 
|---|
| 49 | double tirage_alea(TIREALEA *alea); | 
|---|
| 50 | int end_tirage_alea(TIREALEA *alea); | 
|---|
| 51 |  | 
|---|
| 52 | #ifdef __cplusplus | 
|---|
| 53 | } | 
|---|
| 54 | #endif | 
|---|
| 55 |  | 
|---|
| 56 | #endif | 
|---|
| 57 |  | 
|---|