]> hackdaworld.org Git - physik/posic.git/blob - random/random.h
added sip and dist calc for vasp results
[physik/posic.git] / random / random.h
1 /*
2  * random.c - random functions header file
3  *
4  * author: Frank Zirkelbach <frank.zirkelbach@physik.uni-augsburg.de> 
5  *
6  */
7
8 #ifndef RANDOM_H
9 #define RANDOM_H
10
11 /* datatypes */
12
13 typedef struct s_random {
14         int fd;
15         int logfd;
16         unsigned char status;
17         unsigned int *buffer;
18         unsigned int *b_ptr;
19         double gauss;
20 } t_random;
21
22 /* defines */
23
24 #define RAND_STAT_INITIALIZED           0x01
25 #define RAND_STAT_VERBOSE               0x02
26 #define RAND_STAT_UDEV                  0x04
27 #define RAND_STAT_GAUSS                 0x08
28
29 #define RAND_BUFSIZE                    (1024*1024) /* 4 mega byte */
30
31 #define URAND_MAX                       0xffffffff
32 #define URAND_MAX_PLUS_ONE              0x100000000
33
34 /* function prototypes */
35
36 int rand_init(t_random *random,char *randomfile,int logfd);
37 int rand_close(t_random *random);
38 unsigned int rand_get(t_random *random);
39 double rand_get_double(t_random *random);
40 double rand_get_double_linear(t_random *random,double a,double b);
41 double rand_get_gauss(t_random *random);
42 unsigned int rand_get_int_linear(t_random *radnom,unsigned int max,
43                                  double a,double b);
44 unsigned int rand_get_reject(t_random *random,unsigned int max_x,
45                              unsigned int max_y,unsigned int *graph);
46
47
48 #endif /* RANDOM_H */