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

Comparing ray/src/common/urand.c (file contents):
Revision 1.1 by greg, Fri May 17 12:55:27 1991 UTC vs.
Revision 1.2 by greg, Fri May 17 13:51:14 1991 UTC

# Line 16 | Line 16 | extern char  *malloc();
16  
17   short  *urperm;         /* urand() permutation */
18   int  urmask;            /* bits used in permutation */
19 + static int  urorder;    /* number of bits */
20  
21  
22   initurand(size)         /* initialize urand() for size entries */
# Line 44 | Line 45 | int  size;
45                          else
46                                  urperm[i+offset]++;
47                  }
48 + }
49 +
50 +
51 + int
52 + urhash(d, n)                    /* hash a set of integer values */
53 + register int  *d;
54 + register int  n;
55 + {
56 +        static int  tab[8] = {13623,353,1637,5831,2314,3887,5832,8737};
57 +        register unsigned  hval;
58 +
59 +        hval = 0;
60 +        while (n-- > 0)
61 +                hval += *d++ * tab[n&7];
62 +        return(hval & urmask);
63   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines