aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2017-09-11 15:45:10 +0200
committerHans Nilsson <[email protected]>2017-09-12 13:02:26 +0200
commit24053bba1d00ee959d2b388b08e1bd845d9c6bfa (patch)
tree0d83b89ad03e4ea79c0a89b559c5e9d69e68b7e7 /lib
parent18fb1a9230578456f3d03b4136ed296407bdf53c (diff)
downloadotp-24053bba1d00ee959d2b388b08e1bd845d9c6bfa.tar.gz
otp-24053bba1d00ee959d2b388b08e1bd845d9c6bfa.tar.bz2
otp-24053bba1d00ee959d2b388b08e1bd845d9c6bfa.zip
public_key: clearify random set bounderys in comments
Diffstat (limited to 'lib')
-rw-r--r--lib/public_key/src/pubkey_ssh.erl6
-rw-r--r--lib/public_key/test/erl_make_certs.erl9
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/public_key/src/pubkey_ssh.erl b/lib/public_key/src/pubkey_ssh.erl
index 9bda76d670..5055866ab2 100644
--- a/lib/public_key/src/pubkey_ssh.erl
+++ b/lib/public_key/src/pubkey_ssh.erl
@@ -79,7 +79,11 @@ dh_gex_group(Min, N, Max, undefined) ->
dh_gex_group(Min, N, Max, Groups) ->
case select_by_keylen(Min-10, N, Max+10, Groups) of
{ok,{Sz,GPs}} ->
- {ok, {Sz,lists:nth(crypto:rand_uniform(1, 1+length(GPs)), GPs)}};
+ Rnd = crypto:rand_uniform(1, 1+length(GPs)),
+ %% 1 =< Rnd < 1+length(GPs)
+ %% <=>
+ %% 1 =< Rnd =< length(GPs)
+ {ok, {Sz, lists:nth(Rnd,GPs)}};
Other ->
Other
end.
diff --git a/lib/public_key/test/erl_make_certs.erl b/lib/public_key/test/erl_make_certs.erl
index e4118bab0d..9996f757ca 100644
--- a/lib/public_key/test/erl_make_certs.erl
+++ b/lib/public_key/test/erl_make_certs.erl
@@ -178,8 +178,13 @@ make_tbs(SubjectKey, Opts) ->
_ ->
subject(proplists:get_value(subject, Opts),false)
end,
-
- {#'OTPTBSCertificate'{serialNumber = trunc(random:uniform()*100000000)*10000 + 1,
+ Rnd = trunc(random:uniform()*100000000)*10000 + 1,
+ %% 0.0 =< random:uniform() < 1.0
+ %% =>
+ %% 0.0 =< random:uniform()*100000000 < 100000000.0
+ %% =>
+ %% 1 =< Rnd < 1000000000001
+ {#'OTPTBSCertificate'{serialNumber = Rnd,
signature = SignAlgo,
issuer = Issuer,
validity = validity(Opts),