Skip to content

Instantly share code, notes, and snippets.

@jamestyj
Created October 17, 2014 12:12
Show Gist options
  • Save jamestyj/2c7886fe650350c0f7a6 to your computer and use it in GitHub Desktop.
Save jamestyj/2c7886fe650350c0f7a6 to your computer and use it in GitHub Desktop.
function makeEmail() {
var strValues="abcdefghijklmnopqrstuvwxyz";
var strEmail = "";
var strTmp;
for (var i=0;i<10;i++) {
strTmp = strValues.charAt(Math.round(strValues.length*Math.random()));
strEmail = strEmail + strTmp;
}
strTmp = "";
strEmail = strEmail + "@";
for (var j=0;j<8;j++) {
strTmp = strValues.charAt(Math.round(strValues.length*Math.random()));
strEmail = strEmail + strTmp;
}
strEmail = strEmail + ".com"
return strEmail;
}
var emails = []
for (var i=0; i<100000; i++) {
emails.push(" '" + makeEmail() + "'");
}
print("var EMAILS = [")
print(emails.join(",\n"))
print("]\n")
@jamestyj
Copy link
Author

Execute this via mongo shell and pipe output to emails.js:

mongo --quiet generate-emails.js > emails.js

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