diff options
author | Björn Gustavsson <[email protected]> | 2015-12-14 15:44:55 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2015-12-14 15:44:55 +0100 |
commit | b68383dd9cc7515ec0d37b370a2fc8db7f119211 (patch) | |
tree | 475345061572f9c4e73218f2d7f5f80259cbee3b /lib/common_test | |
parent | e45ed5449659ac615fcf3c8234a57cf8a10fdc42 (diff) | |
parent | 61fd09aaef2474cd74ddbc465e9d1dfd879a4ab5 (diff) | |
download | otp-b68383dd9cc7515ec0d37b370a2fc8db7f119211.tar.gz otp-b68383dd9cc7515ec0d37b370a2fc8db7f119211.tar.bz2 otp-b68383dd9cc7515ec0d37b370a2fc8db7f119211.zip |
Merge branch 'bjorn/deprecate-random/OTP-12502'
* bjorn/deprecate-random/OTP-12502:
Deprecate the 'random' module
Eliminate mentions of 'random' in documentation
mnesia tests: Replace 'random' with 'rand'
percept tests: Replace 'random' with 'rand'
system tests: Replace 'random' with 'rand'
common_test tests: Replace 'random' with 'rand'
gs: Remove the contribs directory
wx: Replace 'random' with 'rand'
stdlib tests: Replace 'random' with 'rand'
kernel test: Replace 'random' with 'rand'
debugger tests: Replace 'random' with 'rand'
compiler tests: Replace 'random' with 'rand'
Emulator test suite: Replace use of 'random' with 'rand'
Use 'rand' instead of the obsolete 'random' module
compile: Eliminate use of the obsolete 'random' module
Diffstat (limited to 'lib/common_test')
-rw-r--r-- | lib/common_test/src/ct_config.erl | 3 | ||||
-rw-r--r-- | lib/common_test/test/ct_master_SUITE.erl | 2 | ||||
-rw-r--r-- | lib/common_test/test/ct_test_support.erl | 8 |
3 files changed, 6 insertions, 7 deletions
diff --git a/lib/common_test/src/ct_config.erl b/lib/common_test/src/ct_config.erl index 251204aa75..33efe7a14a 100644 --- a/lib/common_test/src/ct_config.erl +++ b/lib/common_test/src/ct_config.erl @@ -694,11 +694,10 @@ make_crypto_key(String) -> {[K1,K2,K3],IVec}. random_bytes(N) -> - random:seed(os:timestamp()), random_bytes_1(N, []). random_bytes_1(0, Acc) -> Acc; -random_bytes_1(N, Acc) -> random_bytes_1(N-1, [random:uniform(255)|Acc]). +random_bytes_1(N, Acc) -> random_bytes_1(N-1, [rand:uniform(255)|Acc]). check_callback_load(Callback) -> case code:is_loaded(Callback) of diff --git a/lib/common_test/test/ct_master_SUITE.erl b/lib/common_test/test/ct_master_SUITE.erl index 15b49c67c0..55837352e2 100644 --- a/lib/common_test/test/ct_master_SUITE.erl +++ b/lib/common_test/test/ct_master_SUITE.erl @@ -135,7 +135,7 @@ make_spec(DataDir, FileName, NodeNames, Suites, Config) -> C = lists:map( fun(NodeName) -> - Rnd = random:uniform(2), + Rnd = rand:uniform(2), if Rnd == 1-> {config,NodeName,filename:join(DataDir, "master/config.txt")}; diff --git a/lib/common_test/test/ct_test_support.erl b/lib/common_test/test/ct_test_support.erl index 248ec6c4df..4a47d345e9 100644 --- a/lib/common_test/test/ct_test_support.erl +++ b/lib/common_test/test/ct_test_support.erl @@ -414,14 +414,14 @@ ct_rpc({M,F,A}, Config) -> %%%----------------------------------------------------------------- %%% random_error/1 random_error(Config) when is_list(Config) -> - random:seed(os:timestamp()), + rand:seed(exsplus), Gen = fun(0,_) -> ok; (N,Fun) -> Fun(N-1, Fun) end, - Gen(random:uniform(100), Gen), + Gen(rand:uniform(100), Gen), ErrorTypes = ['BADMATCH','BADARG','CASE_CLAUSE','FUNCTION_CLAUSE', 'EXIT','THROW','UNDEF'], - Type = lists:nth(random:uniform(length(ErrorTypes)), ErrorTypes), - Where = case random:uniform(2) of + Type = lists:nth(rand:uniform(length(ErrorTypes)), ErrorTypes), + Where = case rand:uniform(2) of 1 -> io:format("ct_test_support *returning* error of type ~w", [Type]), |