NAME
Test::Stochastic - checking probabilities of randomized methods
SYNOPSIS
use Test::Stochastic qw(stochastic_ok);
stochastic_ok sub { ...random sub...}, {a => 0.4, b => 0.6};
stochastic_ok {a => 0.4, b => 0.6}, sub { ...random sub...};
Test::Stochastic::setup(times => 100, tolerence => 0.1);
DESCRIPTION
This module can be used to check the probability distribution of answers given by a method. The code fragments in the synopsis above check that the subroutine passed to stochastic_ok
returns a
with probability 0.4, and b
with probability 0.6.
This module will work only if the return values are numbers or strings. Future versions will handle references as well.
EXPORT
None by default, stochastic_ok
on request.
SEE ALSO
This uses Test::More
.
AUTHOR
Abhijit Mahabal, <amahabal@cs.indiana.edu>
COPYRIGHT AND LICENSE
Copyright (C) 2006 by Abhijit Mahabal
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.