Skip to content

Instantly share code, notes, and snippets.

@robert-wallis
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robert-wallis/b7faf94976b153923fde to your computer and use it in GitHub Desktop.
Save robert-wallis/b7faf94976b153923fde to your computer and use it in GitHub Desktop.
8^8 matcher
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#define EIGHTTOEIGHT 0x00FFFFFF
int main(int argc, char** argv)
{
srand(time(NULL));
int match = rand() & EIGHTTOEIGHT;
for (int i = 0; i < EIGHTTOEIGHT; i++)
{
int guess = rand() & EIGHTTOEIGHT;
if (guess == match)
{
printf("Guessed match! %x at try %d\n", guess, i);
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment