diff options
author | Hans Nilsson <[email protected]> | 2017-09-12 13:05:29 +0200 |
---|---|---|
committer | Hans Nilsson <[email protected]> | 2017-09-12 13:05:29 +0200 |
commit | b6fc9a3964a564ac857838243d8e06ccdb904d5e (patch) | |
tree | f2bae5408eb2df9f0d60f0b9cb7a8293efa0d0fe /lib/public_key/test/erl_make_certs.erl | |
parent | 18fb1a9230578456f3d03b4136ed296407bdf53c (diff) | |
parent | ef9c973897ea40744600075a7743bf5f2f3fa2f0 (diff) | |
download | otp-b6fc9a3964a564ac857838243d8e06ccdb904d5e.tar.gz otp-b6fc9a3964a564ac857838243d8e06ccdb904d5e.tar.bz2 otp-b6fc9a3964a564ac857838243d8e06ccdb904d5e.zip |
Merge branch 'hans/public_key/replace_deprecated_random_funcs/OTP-14608' into maint
Diffstat (limited to 'lib/public_key/test/erl_make_certs.erl')
-rw-r--r-- | lib/public_key/test/erl_make_certs.erl | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/public_key/test/erl_make_certs.erl b/lib/public_key/test/erl_make_certs.erl index e4118bab0d..e772ea1734 100644 --- a/lib/public_key/test/erl_make_certs.erl +++ b/lib/public_key/test/erl_make_certs.erl @@ -178,8 +178,9 @@ make_tbs(SubjectKey, Opts) -> _ -> subject(proplists:get_value(subject, Opts),false) end, - - {#'OTPTBSCertificate'{serialNumber = trunc(random:uniform()*100000000)*10000 + 1, + Rnd = rand:uniform( 1000000000000 ), + %% 1 =< Rnd < 1000000000001 + {#'OTPTBSCertificate'{serialNumber = Rnd, signature = SignAlgo, issuer = Issuer, validity = validity(Opts), @@ -466,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; |