Skip Menu |

This queue is for tickets about the Math-BigInt-Random CPAN distribution.

Report information
The Basics
Id: 54215
Status: new
Priority: 0/
Queue: Math-BigInt-Random

People
Owner: Nobody in particular
Requestors: peter.john.acklam [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.04
Fixed in: (no value)



The documentation says about the 'max' parameter that it is "the maximum integer that can be returned". This is wrong. E.g., $x = random_bigint(min => 0, max => 1); will never return 1. Several places in the code, the author has used "int rand VALUE" apparently assuming that this can return VALUE, but it can't. The expression "int rand VALUE" will only return values in the range 0 .. VALUE - 1. Besides, "int rand VALUE" will only return uniformly distributed pseudorandom numbers if and only if VALUE is a power of two and no larger than $Config{randbits}.