mbi_rand.t revision 7c478bd95313f5f23a4c958a745db2134aa03244
use Test;
use strict;
my $count;
{
$| = 1;
my $location = $0; $location =~ s/mbi_rand.t//;
chdir 't' if -d 't';
$count = 128;
}
my $c = 'Math::BigInt';
my $length = 128;
# If you get a failure here, please re-run the test with the printed seed
# value as input "perl t/mbi_rand.t seed" and send me the output
for (my $i = 0; $i < $count; $i++)
{
# length of A and B
# we create the numbers from "patterns", e.g. get a random number and a
# random count and string them together. This means things like
# "100000999999999999911122222222" are much more likely. If we just strung
# together digits, we would end up with "1272398823211223" etc. It also means
# that we get more frequently equal numbers or other special cases.
# print "# As $As\n# Bs $Bs\n";
# print "# A $A\n# B $B\n";
{
}
# check that int(A/B)*B + A % B == A holds for all inputs
# $X = ($A/$B)*$B + 2 * ($A % $B) - ($A % $B);
# print "# ($A / $B, $A % $B ) = $ADB $AMB\n";
# swap 'em and try this, too
# $X = ($B/$A)*$A + $B % $A;
#print "check: $ADB $AMB";
# print " +$two * $AMB = ",$ADB * $A + $two * $AMB,"\n";
# print " -$AMB = ",$ADB * $A + $two * $AMB - $AMB,"\n";
}