Skip to content

Instantly share code, notes, and snippets.

@tobin
Created June 7, 2012 10:30
Show Gist options
  • Select an option

  • Save tobin/2888087 to your computer and use it in GitHub Desktop.

Select an option

Save tobin/2888087 to your computer and use it in GitHub Desktop.
Random password generator
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
char charset[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~!@#$%^&*-+=";
int main(int argc, char **argv) {
srand(time(NULL));
for (int i=0; i<10; i++)
printf("%c", charset[rand() % sizeof(charset)]);
printf("\n");
return 0;
}
@tobin

tobin commented Jun 7, 2012

Copy link
Copy Markdown
Author

"Inspired by" LinkedIn.

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