ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/random.h
(Generate patch)

Comparing ray/src/common/random.h (file contents):
Revision 2.4 by greg, Tue Feb 13 11:32:17 1996 UTC vs.
Revision 2.10 by greg, Thu Mar 27 16:33:38 2003 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1992 Regents of the University of California */
2 <
3 < /* SCCSid "$SunId$ LBL" */
4 <
1 > /* RCSid $Id$ */
2   /*
3   *  random.h - header file for random(3) and urand() function.
7 *
8 *     10/1/85
4   */
5  
6 + #include "copyright.h"
7 +
8 + #ifdef  NORANDOM
9 +
10 + #undef  random
11 + #define  random()       1073741820
12 + #undef  srandom
13 + #define  srandom(s)     (s)
14 + #define  frandom()      0.5
15 + #define  urand(i)       0.5
16 + #define  initurand(n)   (n)
17 +
18 + #else
19 +
20   #ifdef  MSDOS
21  
22 + #if (RAND_MAX <= 65536)
23   #define random()        ((long)rand()<<16^(long)rand()<<6^(long)rand()>>4)
24 + #else
25 + #define random()        rand()
26 + #endif
27 + #define srandom(s)      srand((unsigned)(s))
28  
29 < #define frandom()       (rand()*(1./32768.))
29 > #define frandom()       (rand()*(1./RAND_MAX))
30  
31   #else
32   #ifdef  BSD
# Line 27 | Line 41 | extern long  lrand48();
41   extern double  drand48();
42  
43   #define  random()       lrand48()
44 + #define  srandom(s)     srand48((long)(s))
45   #define  frandom()      drand48()
46  
47   #endif
48   #endif
49  
50   #ifdef  MC
51 +
52   #define  urand(i)       frandom()
53 + #define  initurand(n)   (n)
54 +
55   #else
56 +
57 + extern unsigned short   *urperm;
58 + extern int      urmask;
59 +
60   #define  urand(i)       ((urperm[(i)&urmask]+frandom())/(urmask+1))
61 +
62   #endif
63  
64 < extern short  *urperm;
65 < extern int  urmask;
64 > #endif
65 >
66 > #ifdef NOPROTO
67 >
68 > extern int      initurand();
69 > extern int      ilhash();
70 > extern int      urind();
71 > extern void     multisamp();
72 >
73 > #else
74 >                                /* defined in urand.c */
75 > extern int      initurand(int size);
76 > extern int      ilhash(int *d, int n);
77 >                                /* defined in urind.c */
78 > extern int      urind(int s, int i);
79 >                                /* defined in multisamp.c */
80 > extern void     multisamp(double t[], int n, double r);
81 >
82 > #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines