diff options
author | Dan Gudmundsson <[email protected]> | 2016-11-18 10:27:15 +0100 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2016-11-18 10:27:15 +0100 |
commit | 0c84589f2b32018445ab7c1ee995c89e4ec1e836 (patch) | |
tree | 736c83e9d806429cc83a1f78122eefd2748c84bd /lib/stdlib | |
parent | a778e62570bdd50d0b6e0c860bbf8ee905b6a0a7 (diff) | |
parent | 3c2207ed5993eb6e22f6882e70a497f07c707e4b (diff) | |
download | otp-0c84589f2b32018445ab7c1ee995c89e4ec1e836.tar.gz otp-0c84589f2b32018445ab7c1ee995c89e4ec1e836.tar.bz2 otp-0c84589f2b32018445ab7c1ee995c89e4ec1e836.zip |
Merge branch 'dgud/stdlib/rand-fixup-spec'
* dgud/stdlib/rand-fixup-spec:
Fixup of specs in rand
Diffstat (limited to 'lib/stdlib')
-rw-r--r-- | lib/stdlib/src/rand.erl | 16 |
1 files changed, 5 insertions, 11 deletions
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) -> |