Skip to content

Instantly share code, notes, and snippets.

@kimtg
Last active November 7, 2022 05:06
Show Gist options
  • Save kimtg/83f361303922af96e6a509ddb96a8b8c to your computer and use it in GitHub Desktop.
Save kimtg/83f361303922af96e6a509ddb96a8b8c to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <stdbool.h>
#include <string.h>
int main() {
srand(time(NULL));
char chars[] = "abcdefghijklmnopqrstuvwxyz0123456789";
int nchars = strlen(chars);
while (true) {
int length;
printf("Length: ");
scanf("%d", &length);
int i;
for (i = 0; i < length; i++) {
printf("%c", chars[(int) ((rand() / ((double) RAND_MAX + 1)) * nchars)]);
}
puts("");
}
}
@HazeCS
Copy link

HazeCS commented Nov 7, 2022

dope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment