DF-2645 / mknames.c
/* mknames: emit N random 24-char names (spread across dirhash space) */ #include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char **argv) { long n = atol(argv[1]); long i; unsigned long st = 12345; if (argc < 2) exit(1); setvbuf(stdout, NULL, _IOFBF, 1<<20); for (i = 0; i < n; ++i) { char nb[32]; int j; st = st * 6364136223846793005UL + 1442695040888963407UL; for (j = 0; j < 24; ++j) { nb[j] = 'a' + ((st >> (j*3+ (i&3))) % 26); st = st * 6364136223846793005UL + 1442695040888963407UL; } nb[24] = 0; printf("%s\n", nb); } return 0; } |