diff options
author | yjqiang <13307130285@fudan.edu.cn> | 2018-09-12 10:07:01 +0800 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2018-09-16 12:14:27 +0200 |
commit | 11bf33264c620684fcae6c248df30c0a444babdf (patch) | |
tree | 973f5c000e32d4a1832a92f085f6f839fd37a3b0 /rsa/randnum.py | |
parent | 7619f14036519d19cbfd217823a354635c5c78fc (diff) | |
download | rsa-git-11bf33264c620684fcae6c248df30c0a444babdf.tar.gz |
speedup
"if A and B" if mostly A is True then we should judge B at first
Diffstat (limited to 'rsa/randnum.py')
-rw-r--r-- | rsa/randnum.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/rsa/randnum.py b/rsa/randnum.py index 3c788a5..310acaa 100644 --- a/rsa/randnum.py +++ b/rsa/randnum.py @@ -88,7 +88,7 @@ def randint(maxvalue): if value <= maxvalue: break - if tries and tries % 10 == 0: + if tries % 10 == 0 and tries: # After a lot of tries to get the right number of bits but still # smaller than maxvalue, decrease the number of bits by 1. That'll # dramatically increase the chances to get a large enough number. |