// Test random-number facility.

#include <iostream.h>
#include <stdlib.h>

#include "random.h"

void explain (void)
{
	cout << "q = quit, h = help, p = print five values,\n";
	cout << "r = randomize, s = new seed\n"; 
}

int main(void)
{
	randStream * testStream = new randStream();

	while (true) {
		cout << "qhprs? ";
		char answer[2];
		cin >> answer;
		char cmd = answer[0];
		switch (cmd) {
		case 'q':
			return EXIT_SUCCESS;
		case 'h':
			explain ();
			break;
		case 'p':
			for (int i=0; i < 5; i++)
				cout << testStream -> nextfloat() << "\n";
			break;
		case 'r':
			randomize (testStream);
			break;
		case 's':
			cout << "seed? ";
			unsigned seed;
			cin >> seed;
			testStream -> setseed (seed);
			break;
		}
	}
}
