mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-28 04:05:15 +00:00
BigInteger: change argument names for random / randomPrime
This commit is contained in:
parent
281a8c669e
commit
34a971d317
@ -3094,20 +3094,23 @@ class Math_BigInteger
|
|||||||
* $generator->random($min, $max)
|
* $generator->random($min, $max)
|
||||||
* $min->random($max)
|
* $min->random($max)
|
||||||
*
|
*
|
||||||
* @param Integer $min
|
* @param Integer $arg1
|
||||||
* @param optional Integer $max
|
* @param optional Integer $arg2
|
||||||
* @return Math_BigInteger
|
* @return Math_BigInteger
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function random($min, $max = false)
|
function random($arg1, $arg2 = false)
|
||||||
{
|
{
|
||||||
if ($min === false) {
|
if ($arg1 === false) {
|
||||||
return new Math_BigInteger(0);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($max === false) {
|
if ($arg2 === false) {
|
||||||
$max = $min->copy();
|
$max = $arg1;
|
||||||
$min = $this->copy();
|
$min = $this;
|
||||||
|
} else {
|
||||||
|
$min = $arg1;
|
||||||
|
$max = $arg2;
|
||||||
}
|
}
|
||||||
|
|
||||||
$compare = $max->compare($min);
|
$compare = $max->compare($min);
|
||||||
@ -3170,22 +3173,25 @@ class Math_BigInteger
|
|||||||
* If there's not a prime within the given range, false will be returned. If more than $timeout seconds have elapsed,
|
* If there's not a prime within the given range, false will be returned. If more than $timeout seconds have elapsed,
|
||||||
* give up and return false.
|
* give up and return false.
|
||||||
*
|
*
|
||||||
* @param Integer $min
|
* @param Integer $arg1
|
||||||
* @param optional Integer $max
|
* @param optional Integer $arg2
|
||||||
* @param optional Integer $timeout
|
* @param optional Integer $timeout
|
||||||
* @return Mixed
|
* @return Mixed
|
||||||
* @access public
|
* @access public
|
||||||
* @internal See {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap4.pdf#page=15 HAC 4.44}.
|
* @internal See {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap4.pdf#page=15 HAC 4.44}.
|
||||||
*/
|
*/
|
||||||
function randomPrime($min, $max = false, $timeout = false)
|
function randomPrime($arg1, $arg2 = false, $timeout = false)
|
||||||
{
|
{
|
||||||
if ($min === false) {
|
if ($arg1 === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($max === false) {
|
if ($arg2 === false) {
|
||||||
$max = $min->copy();
|
$max = $arg1;
|
||||||
$min = $this->copy();
|
$min = $this;
|
||||||
|
} else {
|
||||||
|
$min = $arg1;
|
||||||
|
$max = $arg2;
|
||||||
}
|
}
|
||||||
|
|
||||||
$compare = $max->compare($min);
|
$compare = $max->compare($min);
|
||||||
|
Loading…
Reference in New Issue
Block a user