/*@@@@@@@@@@@@@@@@@@@@@@@@ testint.cpp @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 Random Option Pricing
 Summer 2002
 Authors: A. Korobchevsky
          S. Ferrando
 Ryerson University ALL RIGHTS RESERVED
 
 Purpose: Tests the generation of random integers from GNU Scientific Library.
          The user picks generator name, fraction and number of hits.
	  Generators supported so far: 
       MT19937 (use mt as an argument)
		 Tausworthe (taus)
		 GFSR4     (gfsr)
	  See GSL Online Documentation for more information.
	  
     Command line arguments:
          char[] - generator name
          int  - upper limit for random number range (lower is always zero)
          int - number of hits

	  Example:
	     ./testgen mt 10 100000
	     Generator MT19937 will be picked
	     100000 randoms between 0 and 9 will be generated
	     The number of occurences of each number from 0 to 9 will be printed
	     Possible result:
	        0 - 9764
           1 - 9994
           2 - 10434
            ....
           9 - 9801
	  Can be used with standard UNIX time utility.
	  Alternative tests: Pi, Diehard
 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/

#include <iostream>
#include <cstdlib>
using namespace std;
#include "../GSL_RandomGen.h"


// BEGIN All
int main(int argc, char** argv)
{ if (argc != 4)
  { cout << "Usage: ./testint generator upper hits " << endl;
    exit(1);
  }
 
  GSL_RandomGen gen(argv[1]);
  int upper = atoi(argv[2]);
  long sim = atol(argv[3]);

  for (int i = 0; i < upper; i++)
  { int count = 0;
    for (int j = 0; j < sim; j++)
    { int eps = gen.nextInt(upper);
      if (eps == i)
        count++;	
    }  
    cout << i << " encountered " << count << " times\n";
  }
}

// END All
