68#ifdef HAVE_TIMESPEC_GET
70 timespec_get(&ts, TIME_UTC);
71 li=((ts.tv_sec % 10000)*523 ^ ts.tv_nsec*10) ^ ((getpid() % 1000)*983);
72#elif defined HAVE_CLOCK_GETTIME
74 clock_gettime(CLOCK_REALTIME, &ts);
75 li=((ts.tv_sec % 10000)*523 ^ ts.tv_nsec*10) ^ ((getpid() % 1000)*983);
76#elif defined HAVE_GETTIMEOFDAY
79 li=((tv.tv_sec % 10000)*523 ^ tv.tv_usec*13) ^ ((getpid() % 1000)*983);
81 li=(
unsigned int)time(NULL)+(
unsigned int)getpid();
83 li+=(
unsigned int)rand();
172 double dif, v, stl, stu;
175 if(d==NULL || type<0 || type>1)
return 1;
177 dif=up-low;
if(dif<0.0)
return 2;
179 for(i=0; i<nr; i++) d[i]=low;
184 for(i=0; i<nr; i++) d[i] =
drand()*dif + low;
186 stl=copysign(sqrt(fabs(low)),low);
if(!isnormal(stl)) stl=0.0;
187 stu=copysign(sqrt(fabs(up)), up);
if(!isnormal(stu)) stu=0.0;
189 for(i=0; i<nr; i++) {v=
drand()*dif+stl; d[i]=copysign(v*v, v);}
unsigned int drandSeed(short int seed)
Make and optionally set the seed for rand(), drand, drandRange, and drandGaussian().