#include #include #include #include int main(void) { FILE *outfile; int i, j, x, z; unsigned char string[1024]; srand((unsigned)time(NULL)); /* Create file of uniform content*/ outfile = fopen("large1.dat", "wb+"); assert(outfile != NULL); while( (x = rand() & 0xff) == 0 ); for(i = 0; i < 0x4000; i++) fputc(x, outfile); fclose(outfile); /* Create file with long runs */ outfile = fopen("large2.dat", "wb+"); assert(outfile != NULL); for(i = 0; i < 32; i++) { x = rand() & 0xff; z = rand() & 0x3c0; for(j = 0; j < z; j++) fputc(x, outfile); } fclose(outfile); /* Create file with bursty noise */ outfile = fopen("large3.dat", "wb+"); x = rand() & 0xff; for(i = 0; i < 0x10000; i++) { if( (rand() & 0xff) == 0 ) { fputc(rand() & 0xff, outfile); if( (rand() & 1) == 0 ) fputc(rand() & 0xff, outfile); } else { fputc(x, outfile); } } fclose(outfile); /* Create file with almost recurrent patterns */ outfile = fopen("large4.dat", "wb+"); for(i = 0; i < 1024; string[i++] = (char)(rand() & 0xff)); for(i = 0; i < 64; i++) { fwrite(string, 1024 - (rand() & 15), 1, outfile); fputc(rand() & 0xff, outfile); } fclose(outfile); return 0; }