--- ray/src/common/random.h 2015/05/27 08:37:26 2.20 +++ ray/src/common/random.h 2022/04/21 02:52:40 2.24 @@ -1,17 +1,17 @@ -/* RCSid $Id: random.h,v 2.20 2015/05/27 08:37:26 greg Exp $ */ +/* RCSid $Id: random.h,v 2.24 2022/04/21 02:52:40 greg Exp $ */ /* * random.h - header file for random(3) and urand() function. */ #ifndef _RAD_RANDOM_H_ #define _RAD_RANDOM_H_ + +#include + #ifdef __cplusplus extern "C" { #endif -#ifdef _WIN32 - -#include - +#if defined(_WIN32) || defined(_WIN64) #if (RAND_MAX <= 65536) #define random() ((long)rand()<<16^(long)rand()<<6^(long)rand()>>4) #else @@ -23,9 +23,6 @@ extern "C" { #else -extern long lrand48(); -extern double drand48(); - #define random() lrand48() #define srandom(s) srand48((long)(s)) #define frandom() drand48() @@ -38,11 +35,13 @@ extern int urmask; #define urand(i) (urmask ? (urperm[(i)&urmask]+frandom())/(urmask+1.) \ : frandom()) + /* defined in urand.c */ +extern long irandom(long modulus); + extern int initurand(int size); - /* defined in urand.c */ extern int ilhash(int *d, int n); - /* defined in urind.c */ + extern int urind(int s, int i); /* defined in multisamp.c */ extern void multisamp(double t[], int n, double r);