This is an automated email from the git hooks/post-receive script.

ppm-guest pushed a commit to annotated tag v0.10
in repository libmath-prime-util-perl.

commit 15cfc51691c7cfdca1708433c566e03b4d683d77
Author: Dana Jacobsen <d...@acm.org>
Date:   Mon Jul 9 01:08:02 2012 -0600

    Fix an issue with random primes
---
 lib/Math/Prime/Util.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/Math/Prime/Util.pm b/lib/Math/Prime/Util.pm
index e9de7d0..c3b239f 100644
--- a/lib/Math/Prime/Util.pm
+++ b/lib/Math/Prime/Util.pm
@@ -418,6 +418,7 @@ sub primes {
       $binsize  = int( ($oddrange + $nbins - 1) / $nbins );
       $nparts   = int( $oddrange / $binsize );
     }
+    $nparts-- if ($nparts * $binsize) == $oddrange;
 
     my $rpart = $get_rand_range->($nparts);
 
@@ -428,6 +429,7 @@ sub primes {
     #warn "range $oddrange  = $nparts * $binsize + ", $oddrange - ($nparts * 
$binsize), "\n";
     #warn "  chose part $rpart size $partsize\n";
     #warn "  primelow is $low + 2 * $binsize * $rpart = $primelow\n";
+    #die "Result could be too large" if ($primelow + 2*($partsize-1)) > $high;
 
     # Generate random numbers in the interval until one is prime.
     my $loop_limit = 2000 * 1000;  # To protect against broken rand

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libmath-prime-util-perl.git

_______________________________________________
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to