aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/test/crypto_SUITE.erl
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2011-09-07 11:09:43 +0200
committerSverker Eriksson <[email protected]>2011-09-07 11:09:43 +0200
commit02b8d9b4d669ae215b1c2423fa961db1b69a487f (patch)
treef7a1b27dc3a243da40dc2e98d888e6eb245e9342 /lib/crypto/test/crypto_SUITE.erl
parent22dae863060e0d66fa268f6d1cd4d6f084b850ab (diff)
downloadotp-02b8d9b4d669ae215b1c2423fa961db1b69a487f.tar.gz
otp-02b8d9b4d669ae215b1c2423fa961db1b69a487f.tar.bz2
otp-02b8d9b4d669ae215b1c2423fa961db1b69a487f.zip
[crypto] Fix rand_uniform for negative values
Also let it throw badarg if 'Hi' is not larger than 'Lo'.
Diffstat (limited to 'lib/crypto/test/crypto_SUITE.erl')
-rw-r--r--lib/crypto/test/crypto_SUITE.erl11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/crypto/test/crypto_SUITE.erl b/lib/crypto/test/crypto_SUITE.erl
index 283aadb6ea..8d2f42469b 100644
--- a/lib/crypto/test/crypto_SUITE.erl
+++ b/lib/crypto/test/crypto_SUITE.erl
@@ -878,10 +878,17 @@ rand_uniform_aux_test(0) ->
rand_uniform_aux_test(N) ->
?line L = N*1000,
?line H = N*100000+1,
+ ?line crypto_rand_uniform(L, H),
+ ?line crypto_rand_uniform(-L, L),
+ ?line crypto_rand_uniform(-H, -L),
+ ?line crypto_rand_uniform(-H, L),
+ ?line rand_uniform_aux_test(N-1).
+
+crypto_rand_uniform(L,H) ->
?line R1 = crypto:rand_uniform(L, H),
?line t(R1 >= L),
- ?line t(R1 < H),
- ?line rand_uniform_aux_test(N-1).
+ ?line t(R1 < H).
+
%%
%%