aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorGuilherme Andrade <[email protected]>2017-03-22 21:51:17 +0000
committerGuilherme Andrade <[email protected]>2017-03-22 21:51:17 +0000
commit195edd9076c865f8af6a9aeeb02bc032b94c0fb3 (patch)
treedd0ece3da059f0705bd2890cbfb6553703e1b895 /lib
parent54b89c8750bed431275f1f376fb10ec7899ca335 (diff)
downloadotp-195edd9076c865f8af6a9aeeb02bc032b94c0fb3.tar.gz
otp-195edd9076c865f8af6a9aeeb02bc032b94c0fb3.tar.bz2
otp-195edd9076c865f8af6a9aeeb02bc032b94c0fb3.zip
fixup! Support cryptographically strong rand plugin
Minimize use of guards.
Diffstat (limited to 'lib')
-rw-r--r--lib/stdlib/src/rand.erl10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/stdlib/src/rand.erl b/lib/stdlib/src/rand.erl
index ddd22914e2..60da53cd2b 100644
--- a/lib/stdlib/src/rand.erl
+++ b/lib/stdlib/src/rand.erl
@@ -88,15 +88,15 @@ seed(Alg) ->
seed_put(seed_s(Alg)).
-spec seed_s(AlgOrStateOrExpState::builtin_alg() | state() | export_state()) -> state().
-seed_s(Alg) when is_atom(Alg) ->
- seed_s(Alg, {erlang:phash2([{node(),self()}]),
- erlang:system_time(),
- erlang:unique_integer()});
seed_s({AlgHandler, _Seed} = State) when is_map(AlgHandler) ->
State;
seed_s({Alg0, Seed}) ->
{Alg,_SeedFun} = mk_alg(Alg0),
- {Alg, Seed}.
+ {Alg, Seed};
+seed_s(Alg) ->
+ seed_s(Alg, {erlang:phash2([{node(),self()}]),
+ erlang:system_time(),
+ erlang:unique_integer()}).
%% seed/2: seeds RNG with the algorithm and given values
%% and returns the NEW state.