Skip to content

Instantly share code, notes, and snippets.

@timpulver
Created March 19, 2012 19:26
Show Gist options
  • Save timpulver/2125201 to your computer and use it in GitHub Desktop.
Save timpulver/2125201 to your computer and use it in GitHub Desktop.
Create a random number between grA and grB (CPP)
srand ( time(NULL) );
int grA, grB;
grA = 0; grB = i;
int a;
a = grA + (rand() % (grB - grA + 1));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment