LibRan  0.1
Pseudo-random number distribution generator
LRtunif.c
1 #include <stdio.h>
2 #include "libran.h" /* LR_obj */
3 
4 /* only allow 10007 unique "random" numbers */
5 
6 double fc = 1.0 / 10007.;
7 
8 int tirand(LR_obj *o) {
9  static int t_iy = 1777;
10  t_iy *= 1117;
11  t_iy += 37;
12  t_iy %= 10007;
13  return t_iy;
14 }
15 
16 long tlrand(LR_obj *o) {
17  return (long) tirand(o);
18 }
19 
20 float tfrand(LR_obj *o) {
21  return (float) (fc * tirand(o));
22 }
23 
24 double tdrand(LR_obj *o) {
25  return (double) (fc * tirand(o));
26 }
The LibRan common header file.
the fundamental LibRan random variate distribution object
Definition: libran.h:134