#!/usr/bin/perl -w # The script for generating test data. # Written by Jan "Yenya" Kasprzak 2009-04-21 under the Artistic License. # See # http://www.fi.muni.cz/~kas/blog/index.cgi/computers/statistics-problem.html # for explanation. use strict; my ($decay, $count) = @ARGV; if (!$count) { die "Usage: $0 decay count\ne.g.: $0 0.35 100\n"; } # This is to simulate the uneven distribution if intervals: # make them at least not beginning from zero. our $MIN_INTERVAL = 5; our $MAX_INTERVAL = 20; while ($count--) { my $time = $MIN_INTERVAL + rand()*rand()*($MAX_INTERVAL - $MIN_INTERVAL); my $probability = exp(-$decay * $time); print $time, ' ', (rand() < $probability ? '+' : '-'), "\n"; }