/* Copyright (c) 1998 Silicon Graphics, Inc. */ #ifndef lint static char SCCSid[] = "$SunId$ SGI"; #endif /* * Anticorrelated random function due to Christophe Schlick */ #include "random.h" #define NULL 0 #define MAXORDER (8*sizeof(unsigned short)) extern char *malloc(); unsigned short *urperm = NULL; /* urand() permutation */ int urmask; /* bits used in permutation */ int initurand(size) /* initialize urand() for size entries */ int size; { int order, n; register int i, offset; if (urperm != NULL) free((char *)urperm); size--; for (i = 1; size >>= 1; i++) ; order = i>MAXORDER ? MAXORDER : i; urmask = (1< 0) hval += *d++ * tab[n&7]; return(hval); }