26 static uint32_t
ran(
void){
30 int main(
int argc,
char** argv)
33 int count, maxburst, length;
36 printf(
"USAGE: trasher <filename> <count> <maxburst> <seed>\n");
40 f= fopen(argv[1],
"rb+");
46 maxburst= atoi(argv[3]);
49 fseek(f, 0, SEEK_END);
51 fseek(f, 0, SEEK_SET);
54 int burst= 1 +
ran() * (uint64_t) (abs(maxburst)-1) /
UINT32_MAX;
56 fseek(f, pos, SEEK_SET);
58 if(maxburst<0) burst= -maxburst;
60 if(pos + burst > length)
68 fwrite(&val, 1, 1, f);
int main(int argc, char **argv)
static uint32_t ran(void)