aboutsummaryrefslogtreecommitdiffstats
path: root/test/ccured_olden/health/poisson.c
blob: c3ff696f845ac7bdf46db76b0b19cccb14b5575d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* For copyright information, see olden_v1.0/COPYRIGHT */

/**********************************************************
 * poisson.c: handles math routines for health.c          *
 **********************************************************/

#include <stdio.h>
#include <math.h>
#include "health.h"


float my_rand(long idum) 
{
  long                   k;
  float                  answer;
  
  idum ^= MASK;
  k = idum / IQ;
  idum = IA * (idum - k * IQ) - IR * k;
  idum ^= MASK;
  if (idum < 0) 
    idum  += IM;
  answer = AM * idum;
#ifdef GET_OUT
  fprintf(stderr, "my_rand: idum = %d, AM = %e, answer = %4.3f\n", 
	  idum, AM, answer);
#endif GET_OUT
  return answer; 
}