Skip to content

Instantly share code, notes, and snippets.

@tomas789
Created May 5, 2013 09:28
Show Gist options
  • Save tomas789/5520268 to your computer and use it in GitHub Desktop.
Save tomas789/5520268 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <fstream>
#include <string>
void gen_random(char *s, const int len) {
static const char alphanum[] =
"0123456789"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz";
for (int i = 0; i < len; ++i) {
s[i] = alphanum[rand() % (sizeof(alphanum) - 1)];
}
s[len] = 0;
}
int
main(int argc, char * argv[])
{
char w1[13];
char w2[13];
for (std::size_t i = 0; i < 20000000; ++i) {
gen_random(w1, 12);
gen_random(w2, 12);
std::cout << w1 << " : " << w2 << std::endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment