Skip to content

Instantly share code, notes, and snippets.

@ksjgh
Created January 28, 2018 09:28
Show Gist options
  • Select an option

  • Save ksjgh/9862286fbae4f2dd94b90ed8ddba782d to your computer and use it in GitHub Desktop.

Select an option

Save ksjgh/9862286fbae4f2dd94b90ed8ddba782d to your computer and use it in GitHub Desktop.
random number generation
#include <time.h> //added for the random number generator seed
#include <cstdlib>//added to use the rand function
int main()
{
int target;
std::string userString;
int guess = -1;
srand(time(NULL)); //set the seed for the random number generator
target = rand() %100 + 1; //generate the 'random' number
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment