#include <math.h>
#include <stdlib.h>
#include <stream.h>
#include <assert.h>
#include <sys/time.h>

double real_rand();

main(int argc , char ** argv)
{
// Get # random numbers  from command line
int n = atoi(argv[1]);

const int LO = 0, HI = 1000*1000;

for (int i = 0 ; i < n ; i ++)
   cout << (int) ( LO + (HI-LO+1)*real_rand() ) << endl;
}


/* Random number generation routines based on system 48-bit LC RNG:
 * Written by Thomas Kammeyer, UCSD
 *
 * double real_rand() automatically seeds itself if need be
 *                    and returns random numbers from [0,1)
 *
 * 05/22/96 jcm Correction to use of gettimeofday
 */
extern "C" {
   extern double drand48();
   extern void srand48(long);
}

double real_rand()
{
   static int seed_me = 1;  /* "...Seymour, seed me all night long..." */

   if (seed_me) {
      struct timeval tp;
      seed_me = 0;
      gettimeofday(&tp,NULL);
      srand48( tp.tv_sec );
   }

   return drand48();
}

