#include #include #include #include "minwise.h" void printbits(char *name, char *buf,int len){ for(int i=0;it)min=t; } if(min==p0) count++; // printf("trial %d: count=%d min=%d\n",i,count,min); if(i>100&&i%10==9){ double eps= (1.0*count*K)/(i+1)-1.0; //eps=|X|*(count/(i+1)-1/|X|) // printf("After %d trials: eps=%f for |X|=%d\n",i+1,eps,K); if(eps<0) eps=-eps; printf("%d %g\n",(i+1),eps); } } } int main(int c, char **argv){ global_rng=new RNG; global_rng->set_seed(RNG::RAW_SEED_SOURCE,1); c--;argv++; if(c&&strstr(*argv,"test")){//test mode if(c>=2&&strcmp(*argv,"testip")==0){ argv++; testip(atoi(*(argv++))); c-=2; }else if(c>=4&&strcmp(*argv,"testlfsr")==0){ argv++; testlfsr( atoi(*(argv)), atoi(*(argv+1)), atoi(*(argv+2)) ); argv+=3; c-=4; }else if(c>=5&&strcmp(*argv,"testkwhf")==0){ argv++; testkwhf( atoi(*(argv)), atoi(*(argv+1)), atoi(*(argv+2)), atoi(*(argv+3)) ); argv+=4; c-=5; }else if(strcmp(*argv,"testmw")==0){ argv++; testmw( atoi(*(argv)), atoi(*(argv+1)), atoi(*(argv+2)), atoi(*(argv+3)) ); argv+=4; c-=5; }else { } } }