The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Test::Probability - test if results are distributed correctly

SYNOPSIS

  use Test::Probability;

  my @results;
  for (0 .. 1000) {
        $results[rand_fn()]++;
  }
  my @probabilities = (0.5, 0.2, 0.3);
  my $confidence = 0.9;
  dist_ok(@results, @probabilities, $confidence,
    "results match expected with confidence $confidence");

DESCRIPTION

Does your random-number generating function output the distribution you expect? Now you can find out! This module performs a chi-squared test at the specified confidence interval.

EXPORTS

dist_ok
  dist_ok(@results, @probabilities, $confidence,
    "results match probabilities with confidence $confidence");

AUTHOR

Miles Gould, <mgould@cpan.org>

CONTRIBUTING

This module is currently distributed along with Games::Dice::Loaded. Please fork the GitHub repository.

COPYRIGHT AND LICENSE

Copyright (C) 2011 by Miles Gould

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.12.4 or, at your option, any later version of Perl 5 you may have available.

SEE ALSO

Statistics::ChiSquared (only handles even distributions).
Statistics::Distributions (used internally by this module).