tabs to spaces
This commit is contained in:
parent
d6c3aa5e03
commit
8428f5fd6c
|
|
@ -37,7 +37,7 @@ static unsigned short simple2 (void)
|
|||
static unsigned short nr(void)
|
||||
{
|
||||
unsigned short ulRandom = ((float)(0xffff)*rand()/(RAND_MAX+1.0f));
|
||||
return(ulRandom);
|
||||
return(ulRandom);
|
||||
}
|
||||
|
||||
static void run_randomtest( unsigned short (*keygen)(void) )
|
||||
|
|
@ -50,14 +50,14 @@ static void run_randomtest( unsigned short (*keygen)(void) )
|
|||
|
||||
for(i=0;i<rounds;i++)
|
||||
{
|
||||
rnd=keygen();
|
||||
|
||||
for(j=0;j<16;j++)
|
||||
{
|
||||
if(rnd & 1)
|
||||
bitcount[j]++;
|
||||
rnd=rnd>>1;
|
||||
}
|
||||
rnd=keygen();
|
||||
|
||||
for(j=0;j<16;j++)
|
||||
{
|
||||
if(rnd & 1)
|
||||
bitcount[j]++;
|
||||
rnd=rnd>>1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -72,12 +72,12 @@ static void print_bitcount(void)
|
|||
|
||||
for(i=0;i<16;i++)
|
||||
{
|
||||
ratio=(float)bitcount[i]/rounds;
|
||||
if(fabs(ratio-0.5f)>worst)
|
||||
worst=fabs(ratio-0.5f);
|
||||
printf("%.2f ",ratio);
|
||||
ratio=(float)bitcount[i]/rounds;
|
||||
if(fabs(ratio-0.5f)>worst)
|
||||
worst=fabs(ratio-0.5f);
|
||||
printf("%.2f ", ratio);
|
||||
}
|
||||
printf(" Worst: %.3f\n",worst);
|
||||
printf(" Worst: %.3f\n", worst);
|
||||
if(worst>MAX_WORST_ALLOWED) result++;
|
||||
}
|
||||
|
||||
|
|
@ -87,11 +87,11 @@ int main(int argc,const char *argv[])
|
|||
rounds=20000;
|
||||
if(argc>1)
|
||||
{
|
||||
rounds=atoi(argv[1]);
|
||||
rounds=atoi(argv[1]);
|
||||
}
|
||||
|
||||
printf("Running %d rounds.\n\n",rounds);
|
||||
|
||||
|
||||
result=0;
|
||||
#ifdef HAVE_SRANDOMDEV
|
||||
srandomdev();
|
||||
|
|
@ -113,5 +113,6 @@ int main(int argc,const char *argv[])
|
|||
printf("Generator: Numerical Recipes\n");
|
||||
run_randomtest(nr);
|
||||
print_bitcount();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user