From 3c2207ed5993eb6e22f6882e70a497f07c707e4b Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Thu, 17 Nov 2016 11:37:45 +0100 Subject: Fixup of specs in rand Fixed bad specs introduced in commit ff568b5e818. Also suppress improper_lists warnings. --- lib/stdlib/src/rand.erl | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'lib/stdlib') diff --git a/lib/stdlib/src/rand.erl b/lib/stdlib/src/rand.erl index 3b1767e731..1f457b9e0e 100644 --- a/lib/stdlib/src/rand.erl +++ b/lib/stdlib/src/rand.erl @@ -155,7 +155,7 @@ uniform_s(N, State0 = {#{uniform:=Uniform}, _}) %% after a large number of call defined for each algorithm. %% The large number is algorithm dependent. --spec jump(state()) -> {NewS :: state()}. +-spec jump(state()) -> NewS :: state(). jump(State = {#{jump:=Jump}, _}) -> Jump(State). @@ -164,7 +164,7 @@ jump(State = {#{jump:=Jump}, _}) -> %% and write back the new value to the internal state, %% then returns the new value. --spec jump() -> {NewS :: state()}. +-spec jump() -> NewS :: state(). jump() -> seed_put(jump(seed_get())). @@ -323,16 +323,14 @@ exsplus_uniform(Max, {Alg, R}) -> -define(JUMPCONST2, 16#345d2a0f85f788c). -define(JUMPELEMLEN, 58). --spec exsplus_jump(exsplus_state()) -> exsplus_state(). - +-dialyzer({no_improper_lists, exsplus_jump/1}). +-spec exsplus_jump(state()) -> state(). exsplus_jump({Alg, S}) -> {S1, AS1} = exsplus_jump(S, [0|0], ?JUMPCONST1, ?JUMPELEMLEN), {_, AS2} = exsplus_jump(S1, AS1, ?JUMPCONST2, ?JUMPELEMLEN), {Alg, AS2}. --spec exsplus_jump(state(), state(), pos_integer(), pos_integer()) -> - {state(), state()}. - +-dialyzer({no_improper_lists, exsplus_jump/4}). exsplus_jump(S, AS, _, 0) -> {S, AS}; exsplus_jump(S, [AS0|AS1], J, N) -> @@ -441,10 +439,6 @@ exs1024_jump({Alg, {L, RL}}) -> {ASL, ASR} = lists:split(?RINGLEN - P, AS), {Alg, {ASL, lists:reverse(ASR)}}. --spec exs1024_jump(state(), list(non_neg_integer()), - list(non_neg_integer()), non_neg_integer(), - non_neg_integer(), non_neg_integer()) -> list(non_neg_integer()). - exs1024_jump(_, AS, _, _, _, 0) -> AS; exs1024_jump(S, AS, [H|T], _, 0, TN) -> -- cgit v1.2.3