Created
June 17, 2016 03:53
-
-
Save olzaragoza/14f3c25de53e8e09e0ead05b622669b3 to your computer and use it in GitHub Desktop.
random number testing function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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