Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
Fix src/tinymt32.erl interval to (0, 1) and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jj1bdx committed Jan 12, 2016
1 parent 03fd731 commit 26ba9e1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/tinymt32.erl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
%% @author Kenji Rikitake <kenji.rikitake@acm.org>
%% @author Mutsuo Saito
%% @author Makoto Matsumoto
%% @copyright 2012-2014 Kenji Rikitake, Mutsuo Saito, Makoto Matsumoto, Kyoto University, Hiroshima University, The University of Tokyo
%% @copyright 2012-2016 Kenji Rikitake, Mutsuo Saito, Makoto Matsumoto, Kyoto University, Hiroshima University, The University of Tokyo
%% @doc TinyMT 32-bit pseudo random generator module in pure Erlang
%% @end
%% (This is a simplified BSD license.)
%%
%% Copyright (c) 2012-2014 Kenji Rikitake and Kyoto University.
%% Copyright (c) 2012-2016 Kenji Rikitake and Kyoto University.
%% All rights reserved.
%%
%% Copyright (c) 2011 Mutsuo Saito, Makoto Matsumoto, Hiroshima
Expand Down Expand Up @@ -132,11 +132,11 @@ temper(#intstate32{
T2 bxor (TM band T1M).

%% @doc Generate 32bit-resolution float from the TinyMT internal state.
%% (Note: 0.0 =&lt; result &lt; 1.0)
%% (Note: 0.0 &lt; result &lt; 1.0)
-spec temper_float(intstate32()) -> float().

temper_float(R) ->
temper(R) * (1.0 / 4294967296.0).
(temper(R) + 0.5) * (1.0 / 4294967296.0).

-spec period_certification(intstate32()) -> intstate32().

Expand Down Expand Up @@ -388,7 +388,7 @@ uniform_s(R0) ->

%% @doc Generate 32bit-resolution float from the TinyMT internal state
%% in the process dictionary.
%% (Note: 0.0 =&lt; result &lt; 1.0)
%% (Note: 0.0 &lt; result &lt; 1.0)
%% (Compatible with random:uniform/1)

uniform() ->
Expand All @@ -400,8 +400,8 @@ uniform() ->
put(tinymt32_seed, R2),
V.

%% @doc Generate 32bit-resolution float from the given TinyMT internal state.
%% (Note: 0 =&lt; result &lt; MAX (given positive integer))
%% @doc Generate given range of integer from the given TinyMT internal state.
%% (Note: 1 =&lt; result =&lt; MAX (given positive integer))
-spec uniform_s(pos_integer(), intstate32()) -> {pos_integer(), intstate32()}.

uniform_s(Max, R) when is_integer(Max), Max >= 1 ->
Expand All @@ -416,7 +416,7 @@ uniform_s(M, L, R) ->
false -> uniform_s(M, L, R1)
end.

%% @doc Generate 32bit-resolution float from the given TinyMT internal state
%% @doc Generate given range of integer from the given TinyMT internal state
%% in the process dictionary.
%% (Note: 1 =&lt; result =&lt; N (given positive integer))
%% (compatible with random:uniform/1)
Expand Down

0 comments on commit 26ba9e1

Please sign in to comment.