diff options
author | Hans Nilsson <[email protected]> | 2017-09-11 16:03:17 +0200 |
---|---|---|
committer | Hans Nilsson <[email protected]> | 2017-09-12 13:02:26 +0200 |
commit | ef9c973897ea40744600075a7743bf5f2f3fa2f0 (patch) | |
tree | f2bae5408eb2df9f0d60f0b9cb7a8293efa0d0fe /lib/public_key/test | |
parent | 24053bba1d00ee959d2b388b08e1bd845d9c6bfa (diff) | |
download | otp-ef9c973897ea40744600075a7743bf5f2f3fa2f0.tar.gz otp-ef9c973897ea40744600075a7743bf5f2f3fa2f0.tar.bz2 otp-ef9c973897ea40744600075a7743bf5f2f3fa2f0.zip |
public_key: Deprecated random function replaced
Diffstat (limited to 'lib/public_key/test')
-rw-r--r-- | lib/public_key/test/erl_make_certs.erl | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/public_key/test/erl_make_certs.erl b/lib/public_key/test/erl_make_certs.erl index 9996f757ca..e772ea1734 100644 --- a/lib/public_key/test/erl_make_certs.erl +++ b/lib/public_key/test/erl_make_certs.erl @@ -178,11 +178,7 @@ make_tbs(SubjectKey, Opts) -> _ -> subject(proplists:get_value(subject, Opts),false) end, - Rnd = trunc(random:uniform()*100000000)*10000 + 1, - %% 0.0 =< random:uniform() < 1.0 - %% => - %% 0.0 =< random:uniform()*100000000 < 100000000.0 - %% => + Rnd = rand:uniform( 1000000000000 ), %% 1 =< Rnd < 1000000000001 {#'OTPTBSCertificate'{serialNumber = Rnd, signature = SignAlgo, @@ -471,7 +467,8 @@ odd_rand(Size) -> odd_rand(Min, Max). odd_rand(Min,Max) -> - Rand = crypto:rand_uniform(Min,Max), + %% Odd random number N such that Min =< N =< Max + Rand = (Min-1) + rand:uniform(Max-Min), % Min =< Rand < Max case Rand rem 2 of 0 -> Rand + 1; |