/****************************************************************************/
/*                                                                          */
/*  Function:  Show how to SEED the builtin random number generator.        */
/*                                                                          */
/*  Author:    Bary W Pollack                                               */
/*                                                                          */
/*  File:      RandomSeed.cpp                                               */
/*                                                                          */
/*  Date:      02/21/01      Revised:                                       */
/*                                                                          */
/*  Input:     None                                                         */
/*                                                                          */
/****************************************************************************/

#include <iostream>
#include <iomanip>
#include <cstdlib>

int main (void)
{
    using namespace std;

    int i;
    cout << "How to Reset the Random Number Generator" << endl << endl;

    cout << "Ten random integers..." << endl;
    for (i = 0; i < 10; i++)
        cout << setw(6) << rand();
    cout << endl;

    cout << endl
         << "Seed the Random Number Generator" << endl
         << "Ten more random integers..." << endl;

    srand (1234);
    for (i = 0; i < 10; i++)
        cout << setw(6) << rand();
    cout << endl;

    cout << endl
         << "Reseed the Random Number Generator" << endl
         << "Same ten random integers..." << endl;

    srand (1234);
    for (i = 0; i < 10; i++)
        cout << setw(6) << rand();
    cout << endl << endl;   

    return 0;
}

/****************************************************************************/
