#!/usr/bin/env perl
use Math::Random::OO::Normal;
use Statistics::LineFit;
use Statistics::Lite;
$lineFit = Statistics::LineFit->new();
$prng = Math::Random::OO::Normal->new();
@seeds = (7);
$rv = $prng->seed( @seeds );
for ($j = 0; $j < 100000; $j++) {
    @x = ();
    @y = ();
    for ($i = 0; $i < 21; $i++) {
	$rnd = $prng->next();
	#print "$i $rnd\n";
	push (@x, 0.5*$i);
	push (@y, $rnd);
    }
    $lineFit->setData(\@x, \@y) or die "Invalid regression data";
    ($intercept, $slope) = $lineFit->coefficients();
    #print "Slope: $slope  Y-intercept: $intercept\n";
    push(@slopes, $slope);
    push(@yints, $intercept);
}
$sigma_slopes = Statistics::Lite::stddev(@slopes);
$sigma_yints = Statistics::Lite::stddev(@yints);
print "$sigma_slopes, $sigma_yints\n";
exit;
