Change comments. (The expected number of iterations in BN_rand_range
never exceeds 1.333...).
This commit is contained in:
parent
a0707e6170
commit
d82242169b
1 changed files with 2 additions and 2 deletions
|
@ -162,7 +162,7 @@ int BN_rand_range(BIGNUM *r, BIGNUM *min, BIGNUM *range)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
/* range = 11..._2, so each iteration succeeds with probability > .5 */
|
/* range = 11..._2, so each iteration succeeds with probability > .75 */
|
||||||
if (!BN_rand(r, n, 0, 0)) return 0;
|
if (!BN_rand(r, n, 0, 0)) return 0;
|
||||||
}
|
}
|
||||||
while (BN_cmp(r, range) >= 0);
|
while (BN_cmp(r, range) >= 0);
|
||||||
|
@ -178,7 +178,7 @@ int BN_rand_range(BIGNUM *r, BIGNUM *min, BIGNUM *range)
|
||||||
* (which is either r, r - range, or r - 2*range).
|
* (which is either r, r - range, or r - 2*range).
|
||||||
* Otherwise, iterate once more.
|
* Otherwise, iterate once more.
|
||||||
* Since 3*range = 11..._2, each iteration succeeds with
|
* Since 3*range = 11..._2, each iteration succeeds with
|
||||||
* probability > .5. */
|
* probability > .75. */
|
||||||
if (BN_cmp(r ,range) >= 0)
|
if (BN_cmp(r ,range) >= 0)
|
||||||
{
|
{
|
||||||
if (!BN_sub(r, r, range)) return 0;
|
if (!BN_sub(r, r, range)) return 0;
|
||||||
|
|
Loading…
Reference in a new issue