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

Last change on this file since 2322 was 851, checked in by ansari, 25 years ago

Ajout de srandgen.h .c (Ex nbrandom) Reza 10/4/2000

File size: 1.3 KB
Line 
1/* fonctions pour generateurs aleatoires */
2/* cmv 23/06/94 */
3/* R.Ansari 04/2000 Copie de nbrand.h .c */
4
5#ifndef SRANDGEN_H_SEEN
6#define SRANDGEN_H_SEEN
7
8#include "machdefs.h"
9#include <stdlib.h>
10#ifdef __MWERKS__
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
22struct tirage_alea {
23 int Nbin;
24 double Min,Max,Lbin;
25 double *Tab;
26};
27typedef struct tirage_alea TIREALEA;
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33void Ini_Ranf_Quick(long seed_val, int lp);
34void Ini_Ranf(unsigned short seed_16v[3], int lp);
35void Get_Ranf(unsigned short seed_16v[3], int lp);
36void Auto_Ini_Ranf(int lp);
37
38void SetGauRange(double range);
39float NorRand1(void);
40double GauRnd1(double am, double s);
41float NorRand(void);
42double GauRnd(double am, double s);
43int NormCo(double *a,double *b
44 ,double mx,double my,double sx,double sy,double ro);
45void NormGau(double *x,double *y
46 ,double mx,double my,double sa,double sb,double teta);
47
48TIREALEA *init_tirage_alea(int nbin,double xmin,double xmax,double (*fonc) (double));
49double tirage_alea(TIREALEA *alea);
50int end_tirage_alea(TIREALEA *alea);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
Note: See TracBrowser for help on using the repository browser.