>1)^mag01[y&0x1UL];
} for(;kk>1)^mag01[y&0x1UL];
}
y=(mt[N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK);
mt[N-1]=mt[M-1]^(y>>1)^mag01[y&0x1UL];mti=0; }
y=mt[mti++]; /*Tempering*/
y^=(y>>11); y^=(y<<7)&0x9d2c5680UL;y^=(y<<15)&0xefc60000UL;y^=(y>>18);
return y;
} /*generatesarandomnumberon[0,0x7fffffff]-interval*/
long genrand_int31(void)
{ return(long)(genrand_int32()>>1); } /*generatesarandomnumberon[0,1]-real-interval*/
double genrand_real1(void)
{ return genrand_int32()*(1.0/4294967295.0); }
double genrand_real2(void)
{ return genrand_int32()*(1.0/4294967296.0);/*dividedby2^32*/ } /*generatesarandomnumberon(0,1)-real-interval*/
double genrand_real3(void)
{ return(((double)genrand_int32())+0.5)*(1.0/4294967296.0);/*dividedby2^32*/ }
/*generatesarandomnumberon[0,1)with53-bitresolution*/
double genrand_res53(void)
{ unsigned long a=genrand_int32()>>5, b=genrand_int32()>>6;
return(a*67108864.0+b)*(1.0/9007199254740992.0); } /*TheserealversionsareduetoIsakuWada,2002/01/09added*/
int main(void){
int i; unsigned long init[4]={0x123,0x234,0x345,0x456},length=4;init_by_array(init,length); printf("1000outputsofgenrand_int32()\n");
for(i=0;i<1000;i++)
{
printf("%10lu",genrand_int32());
if(i%5==4)printf("\n"); }
printf("\n1000outputsofgenrand_real2()\n");
for(i=0;i<1000;i++){ printf("%10.8f",genrand_real2());
if(i%5==4)printf("\n"); }
return 0;
}