Created
May 5, 2013 09:28
-
-
Save tomas789/5520268 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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