title: Random String Generator for Serial
body: <p>I'm working on a programm that generates Serial Codes. I know there a several threads about this topic, but I wasn't able to solve my problem.</p>
  
  <p>I want to create a string that looks like this:
  3S6G-TXMS-RLP6-VE5N</p>
  
  <p>I can only use uppercase letters and numbers and every group of characters (like 3S6G) can only have a max. of 2 numbers in it. </p>
  
  <p>My real struggle is that I have to open the internet explorer and navigate it to a address that includes this serial. It should look like this one: <a href="https://www.mywebpage.com/serial/3S6G-TXMS-RLP6-VE5N" rel="nofollow">https://www.mywebpage.com/serial/3S6G-TXMS-RLP6-VE5N</a>.</p>
  
  <p>I hope someone can help me, because I'm not able to find a solution by myself.</p>
  
  <p>At the moment it doesn't run, when I start the program, it instantly crashes. Also I didn't implement the Internet Explorer yet.</p>
  
  <p>My Code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;windows.h&gt;
  #include &lt;time.h&gt;
  
  static const char abc[]=
  "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  "123456789";
  
  char Str[80];
  char Str2[80];
  char Str3[80];
  char Str4[80];
  char Stra[80];
  unsigned int i;
  
  int StringLength = sizeof(abc) -1;
  
  char genRandom() {
      return abc[rand() % StringLength];
  }
  
  
  int main()
  {
      SetConsoleTitle("Serial Generator");
  
      srand(time(NULL));
      for(i = 0; i &lt; 4; i++) {
              sprintf(Str, "%s", genRandom());
      }
  
      srand(time(NULL)-1);
      for(i = 0; i &lt; 4; i++) {
              sprintf(Str2, "%s", genRandom());
      }
  
      srand(time(NULL)-2);
      for(i = 0; i &lt; 4; i++) {
              sprintf(Str3, "%s", genRandom());
      }
  
      srand(time(NULL)-3);
      for(i = 0; i &lt; 4; i++) {
              sprintf(Str4, "%s", genRandom());
      }
  
  sprintf(Stra, "%s-%s-%s-%s", Str, Str2, Str3, Str4);
  
  
  printf("Your serial: \n");
  printf("%s \n", Stra);
  
  return 0;
  }
  </code></pre>
  
  <p>I'm new to C, so please apologize if I ask dump questions.</p>