void generateFile(char *path, long size, int minKeyValue, int maxKeyValue, int minValLen, int maxValLen) { srand(time(NULL)); FILE *file = fopen(path, "w"); long i; int next; fprintf(file, "%ld\n", size); for (i = 0; i < size; i++) { next = randInt(minKeyValue, maxKeyValue); int len = randInt(minValLen, maxValLen); char *value = randStr(len); fprintf(file, "%d %s\n", next, value); free(value); } fclose(file); }
int V() { printf("%s ", randStr(v, 2)); }
int N() { printf("%s ", randStr(n, 3)); }
int D() { printf("%s ", randStr(d, 3)); }