Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #4 from kostis/dialyzer-fixes

Dialyzer fixes
  • Loading branch information...
commit d95465f7672bbb4269ecccb9574ada3fbded26c0 2 parents 0a38c41 + 21ccbb1
@jj1bdx authored
View
4 src/netpbm_test.erl
@@ -59,10 +59,10 @@ pgm_output(X, Y, F) when is_integer(X), is_integer(Y) ->
test() ->
io:format("P1~n# random:uniform/0~n"),
- random:seed(),
+ _ = random:seed(),
pgm_output(512,512,fun random:uniform/0),
io:format("P1~n# random_wh06:uniform/0~n"),
- random_wh06:seed(),
+ _ = random_wh06:seed(),
pgm_output(512,512,fun random_wh06:uniform/0),
io:format("P1~n# sfmt:uniform/0~n"),
sfmt:seed(),
View
4 src/random_wh06_int.erl
@@ -92,7 +92,7 @@ reseed({A1, A2, A3, A4}) ->
%% uniform()
%% Returns a random integer between 0 and 21267638781707063560975648195455661512.
--spec uniform() -> float().
+-spec uniform() -> integer().
uniform() ->
{A1, A2, A3, A4} = case get(random_wh06_seed) of
@@ -130,7 +130,7 @@ uniform(N) when is_integer(N), N >= 1, N =< 212676387817070635609756481954556615
%% uniform_s(State) -> {F, NewState}
%% Returns a random integer between 0 and 21267638781707063560975648195455661512.
--spec uniform_s(ran()) -> {float(), ran()}.
+-spec uniform_s(ran()) -> {integer(), ran()}.
uniform_s({A1, A2, A3, A4}) ->
B1 = (11600 * A1) rem 2147483579,
View
26 src/sfmt216091_tests.erl
@@ -58,75 +58,75 @@ test_speed_rand_rec1(X, Q, I) ->
test_speed_rand_rec1(X - 1, Q, I2).
test_speed_rand(P, Q) ->
- statistics(runtime),
+ _ = statistics(runtime),
I = sfmt216091:init_gen_rand(1234),
ok = test_speed_rand_rec1(P, Q, I),
{_, T} = statistics(runtime),
T.
test_speed_sfmt_uniform_rec1(Acc, 0, _, _, _) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
ok;
test_speed_sfmt_uniform_rec1(Acc, X, 0, R, I) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
test_speed_sfmt_uniform_rec1([], X - 1, R, R, I);
test_speed_sfmt_uniform_rec1(Acc, X, Q, R, I) ->
{F, I2} = sfmt216091:uniform_s(I),
test_speed_sfmt_uniform_rec1([F|Acc], X, Q - 1, R, I2).
test_speed_sfmt_uniform(P, Q) ->
- statistics(runtime),
+ _ = statistics(runtime),
I = sfmt216091:seed(),
ok = test_speed_sfmt_uniform_rec1([], P, Q, Q, I),
{_, T} = statistics(runtime),
T.
test_speed_orig_uniform_rec1(Acc, 0, _, _, _) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
ok;
test_speed_orig_uniform_rec1(Acc, X, 0, R, I) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
test_speed_orig_uniform_rec1([], X - 1, R, R, I);
test_speed_orig_uniform_rec1(Acc, X, Q, R, I) ->
{F, I2} = random:uniform_s(I),
test_speed_orig_uniform_rec1([F|Acc], X, Q - 1, R, I2).
test_speed_orig_uniform(P, Q) ->
- statistics(runtime),
+ _ = statistics(runtime),
I = random:seed(),
ok = test_speed_orig_uniform_rec1([], P, Q, Q, I),
{_, T} = statistics(runtime),
T.
test_speed_rand_max_rec1(Acc, 0, _, _, _) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
ok;
test_speed_rand_max_rec1(Acc, X, 0, R, I) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
test_speed_rand_max_rec1([], X - 1, R, R, I);
test_speed_rand_max_rec1(Acc, X, Q, R, I) ->
{F, I2} = sfmt216091:gen_rand32_max(10000, I),
test_speed_rand_max_rec1([F|Acc], X, Q - 1, R, I2).
test_speed_rand_max(P, Q) ->
- statistics(runtime),
+ _ = statistics(runtime),
I = sfmt216091:init_gen_rand(1234),
ok = test_speed_rand_max_rec1([], P, Q, Q, I),
{_, T} = statistics(runtime),
T.
test_speed_orig_uniform_n_rec1(Acc, 0, _, _, _) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
ok;
test_speed_orig_uniform_n_rec1(Acc, X, 0, R, I) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
test_speed_orig_uniform_n_rec1([], X - 1, R, R, I);
test_speed_orig_uniform_n_rec1(Acc, X, Q, R, I) ->
{F, I2} = random:uniform_s(10000, I),
test_speed_orig_uniform_n_rec1([F|Acc], X, Q - 1, R, I2).
test_speed_orig_uniform_n(P, Q) ->
- statistics(runtime),
+ _ = statistics(runtime),
I = random:seed(),
ok = test_speed_orig_uniform_n_rec1([], P, Q, Q, I),
{_, T} = statistics(runtime),
View
26 src/sfmt4253_tests.erl
@@ -58,75 +58,75 @@ test_speed_rand_rec1(X, Q, I) ->
test_speed_rand_rec1(X - 1, Q, I2).
test_speed_rand(P, Q) ->
- statistics(runtime),
+ _ = statistics(runtime),
I = sfmt4253:init_gen_rand(1234),
ok = test_speed_rand_rec1(P, Q, I),
{_, T} = statistics(runtime),
T.
test_speed_sfmt_uniform_rec1(Acc, 0, _, _, _) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
ok;
test_speed_sfmt_uniform_rec1(Acc, X, 0, R, I) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
test_speed_sfmt_uniform_rec1([], X - 1, R, R, I);
test_speed_sfmt_uniform_rec1(Acc, X, Q, R, I) ->
{F, I2} = sfmt4253:uniform_s(I),
test_speed_sfmt_uniform_rec1([F|Acc], X, Q - 1, R, I2).
test_speed_sfmt_uniform(P, Q) ->
- statistics(runtime),
+ _ = statistics(runtime),
I = sfmt4253:seed(),
ok = test_speed_sfmt_uniform_rec1([], P, Q, Q, I),
{_, T} = statistics(runtime),
T.
test_speed_orig_uniform_rec1(Acc, 0, _, _, _) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
ok;
test_speed_orig_uniform_rec1(Acc, X, 0, R, I) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
test_speed_orig_uniform_rec1([], X - 1, R, R, I);
test_speed_orig_uniform_rec1(Acc, X, Q, R, I) ->
{F, I2} = random:uniform_s(I),
test_speed_orig_uniform_rec1([F|Acc], X, Q - 1, R, I2).
test_speed_orig_uniform(P, Q) ->
- statistics(runtime),
+ _ = statistics(runtime),
I = random:seed(),
ok = test_speed_orig_uniform_rec1([], P, Q, Q, I),
{_, T} = statistics(runtime),
T.
test_speed_rand_max_rec1(Acc, 0, _, _, _) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
ok;
test_speed_rand_max_rec1(Acc, X, 0, R, I) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
test_speed_rand_max_rec1([], X - 1, R, R, I);
test_speed_rand_max_rec1(Acc, X, Q, R, I) ->
{F, I2} = sfmt4253:gen_rand32_max(10000, I),
test_speed_rand_max_rec1([F|Acc], X, Q - 1, R, I2).
test_speed_rand_max(P, Q) ->
- statistics(runtime),
+ _ = statistics(runtime),
I = sfmt4253:init_gen_rand(1234),
ok = test_speed_rand_max_rec1([], P, Q, Q, I),
{_, T} = statistics(runtime),
T.
test_speed_orig_uniform_n_rec1(Acc, 0, _, _, _) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
ok;
test_speed_orig_uniform_n_rec1(Acc, X, 0, R, I) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
test_speed_orig_uniform_n_rec1([], X - 1, R, R, I);
test_speed_orig_uniform_n_rec1(Acc, X, Q, R, I) ->
{F, I2} = random:uniform_s(10000, I),
test_speed_orig_uniform_n_rec1([F|Acc], X, Q - 1, R, I2).
test_speed_orig_uniform_n(P, Q) ->
- statistics(runtime),
+ _ = statistics(runtime),
I = random:seed(),
ok = test_speed_orig_uniform_n_rec1([], P, Q, Q, I),
{_, T} = statistics(runtime),
View
26 src/sfmt607_tests.erl
@@ -58,75 +58,75 @@ test_speed_rand_rec1(X, Q, I) ->
test_speed_rand_rec1(X - 1, Q, I2).
test_speed_rand(P, Q) ->
- statistics(runtime),
+ _ = statistics(runtime),
I = sfmt607:init_gen_rand(1234),
ok = test_speed_rand_rec1(P, Q, I),
{_, T} = statistics(runtime),
T.
test_speed_sfmt_uniform_rec1(Acc, 0, _, _, _) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
ok;
test_speed_sfmt_uniform_rec1(Acc, X, 0, R, I) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
test_speed_sfmt_uniform_rec1([], X - 1, R, R, I);
test_speed_sfmt_uniform_rec1(Acc, X, Q, R, I) ->
{F, I2} = sfmt607:uniform_s(I),
test_speed_sfmt_uniform_rec1([F|Acc], X, Q - 1, R, I2).
test_speed_sfmt_uniform(P, Q) ->
- statistics(runtime),
+ _ = statistics(runtime),
I = sfmt607:seed(),
ok = test_speed_sfmt_uniform_rec1([], P, Q, Q, I),
{_, T} = statistics(runtime),
T.
test_speed_orig_uniform_rec1(Acc, 0, _, _, _) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
ok;
test_speed_orig_uniform_rec1(Acc, X, 0, R, I) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
test_speed_orig_uniform_rec1([], X - 1, R, R, I);
test_speed_orig_uniform_rec1(Acc, X, Q, R, I) ->
{F, I2} = random:uniform_s(I),
test_speed_orig_uniform_rec1([F|Acc], X, Q - 1, R, I2).
test_speed_orig_uniform(P, Q) ->
- statistics(runtime),
+ _ = statistics(runtime),
I = random:seed(),
ok = test_speed_orig_uniform_rec1([], P, Q, Q, I),
{_, T} = statistics(runtime),
T.
test_speed_rand_max_rec1(Acc, 0, _, _, _) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
ok;
test_speed_rand_max_rec1(Acc, X, 0, R, I) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
test_speed_rand_max_rec1([], X - 1, R, R, I);
test_speed_rand_max_rec1(Acc, X, Q, R, I) ->
{F, I2} = sfmt607:gen_rand32_max(10000, I),
test_speed_rand_max_rec1([F|Acc], X, Q - 1, R, I2).
test_speed_rand_max(P, Q) ->
- statistics(runtime),
+ _ = statistics(runtime),
I = sfmt607:init_gen_rand(1234),
ok = test_speed_rand_max_rec1([], P, Q, Q, I),
{_, T} = statistics(runtime),
T.
test_speed_orig_uniform_n_rec1(Acc, 0, _, _, _) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
ok;
test_speed_orig_uniform_n_rec1(Acc, X, 0, R, I) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
test_speed_orig_uniform_n_rec1([], X - 1, R, R, I);
test_speed_orig_uniform_n_rec1(Acc, X, Q, R, I) ->
{F, I2} = random:uniform_s(10000, I),
test_speed_orig_uniform_n_rec1([F|Acc], X, Q - 1, R, I2).
test_speed_orig_uniform_n(P, Q) ->
- statistics(runtime),
+ _ = statistics(runtime),
I = random:seed(),
ok = test_speed_orig_uniform_n_rec1([], P, Q, Q, I),
{_, T} = statistics(runtime),
View
26 src/sfmt86243_tests.erl
@@ -58,75 +58,75 @@ test_speed_rand_rec1(X, Q, I) ->
test_speed_rand_rec1(X - 1, Q, I2).
test_speed_rand(P, Q) ->
- statistics(runtime),
+ _ = statistics(runtime),
I = sfmt86243:init_gen_rand(1234),
ok = test_speed_rand_rec1(P, Q, I),
{_, T} = statistics(runtime),
T.
test_speed_sfmt_uniform_rec1(Acc, 0, _, _, _) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
ok;
test_speed_sfmt_uniform_rec1(Acc, X, 0, R, I) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
test_speed_sfmt_uniform_rec1([], X - 1, R, R, I);
test_speed_sfmt_uniform_rec1(Acc, X, Q, R, I) ->
{F, I2} = sfmt86243:uniform_s(I),
test_speed_sfmt_uniform_rec1([F|Acc], X, Q - 1, R, I2).
test_speed_sfmt_uniform(P, Q) ->
- statistics(runtime),
+ _ = statistics(runtime),
I = sfmt86243:seed(),
ok = test_speed_sfmt_uniform_rec1([], P, Q, Q, I),
{_, T} = statistics(runtime),
T.
test_speed_orig_uniform_rec1(Acc, 0, _, _, _) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
ok;
test_speed_orig_uniform_rec1(Acc, X, 0, R, I) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
test_speed_orig_uniform_rec1([], X - 1, R, R, I);
test_speed_orig_uniform_rec1(Acc, X, Q, R, I) ->
{F, I2} = random:uniform_s(I),
test_speed_orig_uniform_rec1([F|Acc], X, Q - 1, R, I2).
test_speed_orig_uniform(P, Q) ->
- statistics(runtime),
+ _ = statistics(runtime),
I = random:seed(),
ok = test_speed_orig_uniform_rec1([], P, Q, Q, I),
{_, T} = statistics(runtime),
T.
test_speed_rand_max_rec1(Acc, 0, _, _, _) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
ok;
test_speed_rand_max_rec1(Acc, X, 0, R, I) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
test_speed_rand_max_rec1([], X - 1, R, R, I);
test_speed_rand_max_rec1(Acc, X, Q, R, I) ->
{F, I2} = sfmt86243:gen_rand32_max(10000, I),
test_speed_rand_max_rec1([F|Acc], X, Q - 1, R, I2).
test_speed_rand_max(P, Q) ->
- statistics(runtime),
+ _ = statistics(runtime),
I = sfmt86243:init_gen_rand(1234),
ok = test_speed_rand_max_rec1([], P, Q, Q, I),
{_, T} = statistics(runtime),
T.
test_speed_orig_uniform_n_rec1(Acc, 0, _, _, _) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
ok;
test_speed_orig_uniform_n_rec1(Acc, X, 0, R, I) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
test_speed_orig_uniform_n_rec1([], X - 1, R, R, I);
test_speed_orig_uniform_n_rec1(Acc, X, Q, R, I) ->
{F, I2} = random:uniform_s(10000, I),
test_speed_orig_uniform_n_rec1([F|Acc], X, Q - 1, R, I2).
test_speed_orig_uniform_n(P, Q) ->
- statistics(runtime),
+ _ = statistics(runtime),
I = random:seed(),
ok = test_speed_orig_uniform_n_rec1([], P, Q, Q, I),
{_, T} = statistics(runtime),
View
38 src/sfmt_tests.erl
@@ -58,109 +58,109 @@ test_speed_rand_rec1(X, Q, I) ->
test_speed_rand_rec1(X - 1, Q, I2).
test_speed_rand(P, Q) ->
- statistics(runtime),
+ _ = statistics(runtime),
I = sfmt:init_gen_rand(1234),
ok = test_speed_rand_rec1(P, Q, I),
{_, T} = statistics(runtime),
T.
test_speed_sfmt_uniform_rec1(Acc, 0, _, _, _) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
ok;
test_speed_sfmt_uniform_rec1(Acc, X, 0, R, I) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
test_speed_sfmt_uniform_rec1([], X - 1, R, R, I);
test_speed_sfmt_uniform_rec1(Acc, X, Q, R, I) ->
{F, I2} = sfmt:uniform_s(I),
test_speed_sfmt_uniform_rec1([F|Acc], X, Q - 1, R, I2).
test_speed_sfmt_uniform(P, Q) ->
- statistics(runtime),
+ _ = statistics(runtime),
I = sfmt:seed(),
ok = test_speed_sfmt_uniform_rec1([], P, Q, Q, I),
{_, T} = statistics(runtime),
T.
test_speed_orig_uniform_rec1(Acc, 0, _, _, _) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
ok;
test_speed_orig_uniform_rec1(Acc, X, 0, R, I) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
test_speed_orig_uniform_rec1([], X - 1, R, R, I);
test_speed_orig_uniform_rec1(Acc, X, Q, R, I) ->
{F, I2} = random:uniform_s(I),
test_speed_orig_uniform_rec1([F|Acc], X, Q - 1, R, I2).
test_speed_orig_uniform(P, Q) ->
- statistics(runtime),
+ _ = statistics(runtime),
I = random:seed(),
ok = test_speed_orig_uniform_rec1([], P, Q, Q, I),
{_, T} = statistics(runtime),
T.
test_speed_wh06_uniform_rec1(Acc, 0, _, _, _) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
ok;
test_speed_wh06_uniform_rec1(Acc, X, 0, R, I) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
test_speed_wh06_uniform_rec1([], X - 1, R, R, I);
test_speed_wh06_uniform_rec1(Acc, X, Q, R, I) ->
{F, I2} = random_wh06:uniform_s(I),
test_speed_wh06_uniform_rec1([F|Acc], X, Q - 1, R, I2).
test_speed_wh06_uniform(P, Q) ->
- statistics(runtime),
+ _ = statistics(runtime),
I = random_wh06:seed(),
ok = test_speed_wh06_uniform_rec1([], P, Q, Q, I),
{_, T} = statistics(runtime),
T.
test_speed_rand_max_rec1(Acc, 0, _, _, _) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
ok;
test_speed_rand_max_rec1(Acc, X, 0, R, I) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
test_speed_rand_max_rec1([], X - 1, R, R, I);
test_speed_rand_max_rec1(Acc, X, Q, R, I) ->
{F, I2} = sfmt:gen_rand32_max(10000, I),
test_speed_rand_max_rec1([F|Acc], X, Q - 1, R, I2).
test_speed_rand_max(P, Q) ->
- statistics(runtime),
+ _ = statistics(runtime),
I = sfmt:init_gen_rand(1234),
ok = test_speed_rand_max_rec1([], P, Q, Q, I),
{_, T} = statistics(runtime),
T.
test_speed_orig_uniform_n_rec1(Acc, 0, _, _, _) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
ok;
test_speed_orig_uniform_n_rec1(Acc, X, 0, R, I) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
test_speed_orig_uniform_n_rec1([], X - 1, R, R, I);
test_speed_orig_uniform_n_rec1(Acc, X, Q, R, I) ->
{F, I2} = random:uniform_s(10000, I),
test_speed_orig_uniform_n_rec1([F|Acc], X, Q - 1, R, I2).
test_speed_orig_uniform_n(P, Q) ->
- statistics(runtime),
+ _ = statistics(runtime),
I = random:seed(),
ok = test_speed_orig_uniform_n_rec1([], P, Q, Q, I),
{_, T} = statistics(runtime),
T.
test_speed_wh06_uniform_n_rec1(Acc, 0, _, _, _) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
ok;
test_speed_wh06_uniform_n_rec1(Acc, X, 0, R, I) ->
- lists:reverse(Acc),
+ _ = lists:reverse(Acc),
test_speed_wh06_uniform_n_rec1([], X - 1, R, R, I);
test_speed_wh06_uniform_n_rec1(Acc, X, Q, R, I) ->
{F, I2} = random_wh06:uniform_s(10000, I),
test_speed_wh06_uniform_n_rec1([F|Acc], X, Q - 1, R, I2).
test_speed_wh06_uniform_n(P, Q) ->
- statistics(runtime),
+ _ = statistics(runtime),
I = random_wh06:seed(),
ok = test_speed_wh06_uniform_n_rec1([], P, Q, Q, I),
{_, T} = statistics(runtime),
Please sign in to comment.
Something went wrong with that request. Please try again.