SOURCE FILE: 6.11RandNums.cpp


//   
// Example 6.11. Program to print random numbers in the range    
// 0 - RAND_MAX with seed based on time   
//    
   
#include <iostream.h>
#include <iomanip.h>   
#include <stdlib.h>   
#include <time.h>   
   
int main(void)   
{   
   int i = 0;   
      
   srand( unsigned(time((time_t *)NULL)) );   
      
   cout << "Random integers between 0 and " << RAND_MAX << ":\n\n";
   while (i < 10)  
   { 
      cout << setw(6) << rand();
      i++;
   }
   
   return 0;
}