1 |
< |
/* Copyright (c) 1986 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1998 Silicon Graphics, Inc. */ |
2 |
|
|
3 |
< |
/* SCCSid "$SunId$ LBL" */ |
3 |
> |
/* SCCSid "$SunId$ SGI" */ |
4 |
|
|
5 |
|
/* |
6 |
< |
* random.h - header file for random(3) function. |
6 |
> |
* random.h - header file for random(3) and urand() function. |
7 |
|
* |
8 |
|
* 10/1/85 |
9 |
|
*/ |
10 |
|
|
11 |
< |
#ifdef BSD |
11 |
> |
#ifdef MSDOS |
12 |
|
|
13 |
+ |
#define random() ((long)rand()<<16^(long)rand()<<6^(long)rand()>>4) |
14 |
+ |
|
15 |
+ |
#define frandom() (rand()*(1./32768.)) |
16 |
+ |
|
17 |
+ |
#else |
18 |
+ |
#ifdef BSD |
19 |
+ |
|
20 |
|
extern long random(); |
21 |
|
|
22 |
< |
#define frandom() (random()*(1./2147483648.)) |
22 |
> |
#define frandom() (random()*(1./2147483648.)) |
23 |
|
|
24 |
|
#else |
25 |
|
|
26 |
|
extern long lrand48(); |
27 |
|
extern double drand48(); |
28 |
|
|
29 |
< |
#define random() lrand48() |
30 |
< |
#define frandom() drand48() |
29 |
> |
#define random() lrand48() |
30 |
> |
#define frandom() drand48() |
31 |
> |
|
32 |
> |
#endif |
33 |
> |
#endif |
34 |
> |
|
35 |
> |
#ifdef MC |
36 |
> |
|
37 |
> |
#define urand(i) frandom() |
38 |
> |
#define initurand(n) (n) |
39 |
> |
|
40 |
> |
#else |
41 |
> |
|
42 |
> |
extern unsigned short *urperm; |
43 |
> |
extern int urmask, initurand(); |
44 |
> |
|
45 |
> |
#define urand(i) ((urperm[(i)&urmask]+frandom())/(urmask+1)) |
46 |
|
|
47 |
|
#endif |