#include <iostream>
using namespace std;

#include <commandline.h>
#include <histogram.h>
#include <histogramtest.h>
#include <print.h>
#include <random.h>


void histogramtest::test01(int argc, char**argv)
{
  commandline c(argc,argv);

  uint N = 5;
  double wmax=10.0;

  c.mapvar(N,"N");
  c.mapvar(wmax,"wmax");

  random11<double> r;

  histogram<double> hg(0.0,wmax,N);

  uint samples = 200;
  c.mapvar(samples,"samples");
  //c.enablehelp(cout);
  c.enablehelp();

  cout << SHOW(N) << "   -the number of intervals." << endl;
  cout << SHOW(wmax) << "   -the random variable is [0,wmax]" << endl;
  cout << SHOW(samples) << endl;
  cout << endl;

  for (uint i=0; i<samples; ++i)
    hg.eval(wmax*r());

  cout << hg << endl;

  vector<double> fd;
  hg.frequencydist(fd);

  for (uint i=0; i<fd.size(); ++i)
    cout << fd[i] << " ";
  cout << endl << endl;

  hg.printfrequencydistpair(cout);
}



