Skip to content

Instantly share code, notes, and snippets.

@bwedding
Created February 19, 2018 03:17
Show Gist options
  • Save bwedding/a655d3c77c6f05487a23a6c8ec59d399 to your computer and use it in GitHub Desktop.
Save bwedding/a655d3c77c6f05487a23a6c8ec59d399 to your computer and use it in GitHub Desktop.
Generate really bad (non compliant) random email addresses, separated by commas
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
void RandEmail(char *pass);
int main()
{
FILE *fp = NULL;
fopen_s(&fp, "c:/temp/rand.txt", "w");
char pass[256];
for (int i = 0; i < 300000; i++)
{
RandEmail(pass);
strcat_s(pass, ",");
fwrite(pass, strlen(pass),1, fp);
}
fclose(fp);
return 0;
}
void RandEmail(char* pass)
{
int i;
for (i = 0; i < 12; i++)
{
if (i == 8)
pass[i] = '@';
else
pass[i] = rand() % (122 - 97 + 1) + 97;
}
pass[i] = '\0';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment