aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/rand.erl
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2016-11-17 11:37:45 +0100
committerDan Gudmundsson <[email protected]>2016-11-17 11:37:45 +0100
commit3c2207ed5993eb6e22f6882e70a497f07c707e4b (patch)
treedc4e07821925ab07cb88cac615ac7f451d83550f /lib/stdlib/src/rand.erl
parentcf59b46a88582f3a4c486aff1c2eda6662b88eb2 (diff)
downloadotp-3c2207ed5993eb6e22f6882e70a497f07c707e4b.tar.gz
otp-3c2207ed5993eb6e22f6882e70a497f07c707e4b.tar.bz2
otp-3c2207ed5993eb6e22f6882e70a497f07c707e4b.zip
Fixup of specs in rand
Fixed bad specs introduced in commit ff568b5e818. Also suppress improper_lists warnings.
Diffstat (limited to 'lib/stdlib/src/rand.erl')
-rw-r--r--lib/stdlib/src/rand.erl16
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) ->