diff --git a/mktest.c b/mktest.c index 3392bd33..f171ba0c 100644 --- a/mktest.c +++ b/mktest.c @@ -29,6 +29,14 @@ unsigned rnd(unsigned max) return (seed >> 32) % max; } +unsigned rndnotzero(unsigned max) +{ + if (max <= 1) + return 1; + else + return rnd(max - 1) + 1; +} + char CHARSET[] = "qwertyuiopasdfghjklzxcvbnm1234567890 .-+"; #define CHARSET_LEN (sizeof(CHARSET)-1) @@ -195,7 +203,7 @@ void damage(const char* path, int size) } /* write garbage, in case also over the end */ - count = rnd(size); + count = size; while (count) { fputc(rnd(256), f); --count; @@ -367,7 +375,7 @@ int main(int argc, char* argv[]) for(i=b;i