good random number seed c++ code example
Example: seed random c++
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int random = rand();
/* No srand() calls before rand(), so seed = 1*/
cout << "Seed = 1, Random number = " << random << endl;
srand(5);
/* Seed = 5 */
random = rand();
cout << "Seed = 5, Random number = " << random << endl;
return 0;
}