[libmath-prime-util-perl] 18/18: Tweak rand setup a little
Partha P. Mukherjee
ppm-guest at moszumanska.debian.org
Thu May 21 18:46:40 UTC 2015
This is an automated email from the git hooks/post-receive script.
ppm-guest pushed a commit to annotated tag v0.17
in repository libmath-prime-util-perl.
commit 0f25dde6f91e5b96658cfbc97f5257e3c9636e7a
Author: Dana Jacobsen <dana at acm.org>
Date: Thu Dec 20 01:19:22 2012 -0800
Tweak rand setup a little
---
lib/Math/Prime/Util.pm | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/lib/Math/Prime/Util.pm b/lib/Math/Prime/Util.pm
index 5ec8880..efcfe03 100644
--- a/lib/Math/Prime/Util.pm
+++ b/lib/Math/Prime/Util.pm
@@ -454,14 +454,7 @@ sub primes {
# Returns a function that will get a uniform random number between 0 and
# $max inclusive.
- #
- # Relies on rand working like system rand. If you use Math::Random::MT,
- # make sure you use version 1.16 or later.
sub _get_rand_func {
- if (!defined $_Config{'irand'} && defined &::rand) {
- # They have not given us an irand function, but they have their own rand.
- $_Config{'irand'} = sub { int(4294967296.0 * ::rand()) };
- }
# We first make a function irandf that returns a 32-bit integer. This
# will be a number uniformly in the range [0, 2^32-1]. This corresponds
# to the irand function of many CPAN modules:
@@ -477,6 +470,10 @@ sub primes {
# 2) main::rand(), exportable by many modules
# 3) CORE::rand(). Hopefully one call will work, otherwise use many.
my $irandf = $_Config{'irand'};
+ if (!defined $irandf && defined &::rand) {
+ # They have not given us an irand function, but they have their own rand.
+ $irandf = sub { int(4294967296.0 * ::rand()) };
+ }
if (!defined $irandf) {
if ($_Config{'system_randbits'} >= 32) {
$irandf = sub { int(4294967296.0 * CORE::rand()) };
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmath-prime-util-perl.git
More information about the Pkg-perl-cvs-commits
mailing list