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