// demonstrates usage of random function // Mikhail Nesterenko // 9/16/2009 #include #include #include using std::cout; using std::cin; using std::endl; int main(){ srand(time(nullptr)); // giving random number generator // unpredictable seed // srand(2); // giving predictable seed cout << "Printing random numbers between 0 and " << RAND_MAX << endl; char answer; do{ cout << "Random number is: " << rand() << endl; cout << "Another? [y/n] "; cin >> answer; }while(answer == 'y'); }