% random.pl
:- ensure_loaded(format),
   ensure_loaded(bins),
   ensure_loaded(ranf),
   ensure_loaded(normal),
   ensure_loaded(beta),
   ensure_loaded(gamma).

demo :- tell('random.out'), ignore(demo1), told.

demo1 :-
	Repeats is 10^4,
	forall(member(F, [normal(20,2),
			  10*beta(0.8),
			  gamma(10,15),
			  gamma(10,5),
		  	  gamma(10,2)
		         ]),
	       demo2(Repeats,F)).

demo2(Repeats,F) :-
	format('\n\n---| ~w * ~w |-------',
	       [Repeats,F]),
	Size=1,
	% standard "REPEATS times do"
	findall(X,(between(1,Repeats,_)
                   % here's a wierd one: calling
                   % the function passed in as data
	          ,X is F
	          ),L0),
	cutDown2Sizes(Size,L0,L),
	dist(5,5,100,L).

cutDown2Sizes(Size) -->
	maplist(cutDown2Size(Size)).

cutDown2Size(Size,X,Y) :-
	Y is round(X/Size).


