diff options
author | Anders Svensson <[email protected]> | 2016-06-12 09:09:59 +0200 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2016-06-12 09:09:59 +0200 |
commit | c2861de76ca39217a0cf4fc284f8eeaf3f7d2477 (patch) | |
tree | b55bae61e0d47b5ec76daf9207dadd5d3fe374b9 /lib/diameter/test | |
parent | bddd9a9dd2f784eb570795b0f8ecd25d7ed93378 (diff) | |
parent | c980e489d02417e1144d28958fe9abd4017f72a4 (diff) | |
download | otp-c2861de76ca39217a0cf4fc284f8eeaf3f7d2477.tar.gz otp-c2861de76ca39217a0cf4fc284f8eeaf3f7d2477.tar.bz2 otp-c2861de76ca39217a0cf4fc284f8eeaf3f7d2477.zip |
Merge branch 'anders/diameter/rand/OTP-13664'
* anders/diameter/rand/OTP-13664:
Use rand(3) instead of random(3)
Diffstat (limited to 'lib/diameter/test')
-rw-r--r-- | lib/diameter/test/diameter_codec_test.erl | 13 | ||||
-rw-r--r-- | lib/diameter/test/diameter_transport_SUITE.erl | 3 | ||||
-rw-r--r-- | lib/diameter/test/diameter_util.erl | 13 |
3 files changed, 5 insertions, 24 deletions
diff --git a/lib/diameter/test/diameter_codec_test.erl b/lib/diameter/test/diameter_codec_test.erl index 78308856ac..37c41a1761 100644 --- a/lib/diameter/test/diameter_codec_test.erl +++ b/lib/diameter/test/diameter_codec_test.erl @@ -230,13 +230,12 @@ v(Max, Ord, E) when Ord =< Max -> diameter_enum:to_list(E); v(Max, Ord, E) -> - random:seed(diameter_util:seed()), v(Max, Ord, E, []). v(0, _, _, Acc) -> Acc; v(N, Ord, E, Acc) -> - v(N-1, Ord, E, [E(random:uniform(Ord)) | Acc]). + v(N-1, Ord, E, [E(rand:uniform(Ord)) | Acc]). %% arity/3 @@ -518,15 +517,7 @@ random(M) -> random(0,M). random(Mn,Mx) -> - seed(get({?MODULE, seed})), - Mn + random:uniform(Mx - Mn + 1) - 1. - -seed(undefined) -> - put({?MODULE, seed}, true), - random:seed(diameter_util:seed()); - -seed(true) -> - ok. + Mn + rand:uniform(Mx - Mn + 1) - 1. %% run/1 %% diff --git a/lib/diameter/test/diameter_transport_SUITE.erl b/lib/diameter/test/diameter_transport_SUITE.erl index f2884eacb4..c94f46b7a5 100644 --- a/lib/diameter/test/diameter_transport_SUITE.erl +++ b/lib/diameter/test/diameter_transport_SUITE.erl @@ -338,13 +338,12 @@ make_msg() -> %% crypto:rand_bytes/1 isn't available on all platforms (since openssl %% isn't) so roll our own. rand_bytes(N) -> - random:seed(diameter_util:seed()), rand_bytes(N, <<>>). rand_bytes(0, Bin) -> Bin; rand_bytes(N, Bin) -> - Oct = random:uniform(256) - 1, + Oct = rand:uniform(256) - 1, rand_bytes(N-1, <<Oct, Bin/binary>>). %% =========================================================================== diff --git a/lib/diameter/test/diameter_util.erl b/lib/diameter/test/diameter_util.erl index f26f1e999a..37fcbbc267 100644 --- a/lib/diameter/test/diameter_util.erl +++ b/lib/diameter/test/diameter_util.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2016. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -31,7 +31,6 @@ fold/3, foldl/3, scramble/1, - seed/0, unique_string/0, have_sctp/0]). @@ -178,23 +177,15 @@ scramble(L) -> [[fun s/1, L]]). s(L) -> - random:seed(seed()), s([], L). s(Acc, []) -> Acc; s(Acc, L) -> - {H, [T|Rest]} = lists:split(random:uniform(length(L)) - 1, L), + {H, [T|Rest]} = lists:split(rand:uniform(length(L)) - 1, L), s([T|Acc], H ++ Rest). %% --------------------------------------------------------------------------- -%% seed/0 - -seed() -> - {_,T} = diameter_lib:seed(), - T. - -%% --------------------------------------------------------------------------- %% unique_string/0 unique_string() -> |