Skip to content

Instantly share code, notes, and snippets.

@olzaragoza
Created June 17, 2016 06:57
Show Gist options
  • Save olzaragoza/22e692191e3b4bad2a19690fd6383928 to your computer and use it in GitHub Desktop.
Save olzaragoza/22e692191e3b4bad2a19690fd6383928 to your computer and use it in GitHub Desktop.
C++ rand() function usage examples
random1 = rand() % 10; // range 0 to 9
random2 = rand() % 100 + 1; // range 1 to 100
random3 = rand() % 22 + 1999; // range 1999-2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment