Skip to content

Instantly share code, notes, and snippets.

@olzaragoza
Created June 17, 2016 03:53
Show Gist options
  • Save olzaragoza/14f3c25de53e8e09e0ead05b622669b3 to your computer and use it in GitHub Desktop.
Save olzaragoza/14f3c25de53e8e09e0ead05b622669b3 to your computer and use it in GitHub Desktop.
random number testing function
void randomTesting() {
cout << "Random Number Generation Testing" << endl << endl;
cout << "Seeding the number generator... ";
// srand(5); //seed the random number generator with 5
cout << "Done!" << endl;
cout << "Generating 10 random integers..... ";
int extraCount = 0;
while (1) {
vector<int> randVector; //to store the random numbers
for (int i = 0; i < 10; ++i) {
// srand(5);
// srand(time(nullptr));
randVector.push_back(rand() % 10);
}
cout << "\nNumbers: ";
for (const int& number : randVector) {
cout << " " << number;
}
extraCount++;
if (extraCount == 10) break;
}
cout << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment