Test::Stochastic - checking probabilities of randomized methods
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);
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.
stochastic_ok
a
b
This module will work only if the return values are numbers or strings. Future versions will handle references as well.
None by default, stochastic_ok on request.
This uses Test::More.
Test::More
Abhijit Mahabal, <amahabal@cs.indiana.edu>
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.
To install Test::Stochastic, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Stochastic
CPAN shell
perl -MCPAN -e shell install Test::Stochastic
For more information on module installation, please visit the detailed CPAN module installation guide.