anchor.diff:      end.
   
   %% seed/1:
  -%% seed({A1, A2, A3}) is equivalent to seed(A1, A2, A3), and
  -%% Seed({Alg, AS}) is equivalent to seed(Alg, AS).
  -%% (the 3-element tuple argument is compatible with the random module,
  -%% and the 2-element tuple argument is a new function.)
  -
  --spec seed({Alg :: alg_handler(), AS :: alg_state()} |
  -           {A1 :: integer(), A2 :: integer(), A3 :: integer()}) ->
  -      undefined | state().
  +%% seed({A1, A2, A3}) is equivalent to seed(A1, A2, A3).
  +
  +-spec seed({A1, A2, A3}) -> 'undefined' | state() when
  +      A1 :: integer(),
  +      A2 :: integer(),
  +      A3 :: integer().
   
   seed({A1, A2, A3}) ->
  -    seed(A1, A2, A3);
  -seed({Alg, AS}) ->
  -    seed(Alg, AS).
  +    seed(A1, A2, A3).
   
   %% seed/3: seeds RNG with integer values in the process dictionary,
   %% and returns the old state.
  -%% (compatible with the random module)
  -
   -spec seed(A1 :: integer(), A2 :: integer(), A3 :: integer()) ->
         undefined | state().
   
   seed(A1, A2, A3) ->
  -    seed(?DEFAULT_ALG_HANDLER, {A1, A2, A3}).
  -
  -%% seed/2: seeds RNG with the algorithm handler and given values
  -%% in the process dictionary, and returns the old state.
  -%% Note: the type of the values depends on the algorithm handler.
  -%% (new function)
  -
  --spec seed(Alg :: atom() | alg_handler(), AS :: alg_state()) -> state().
  -
  -seed(Alg0, AS0) when is_atom(Alg0) ->
  -    Alg = #alg{seed=Seed} = mk_alg(Alg0),
  +    Old = seed_get(),
  +    _ = seed(?DEFAULT_ALG_HANDLER, {A1, A2, A3}),
  +    Old.
  +
  +%% seed/2: seeds RNG with the algorithm and given values or previous state
  +%% and returns the NEW state.
  +
  +-spec seed(Alg :: alg(),
  +	   state() | {integer(), integer(), integer()}) ->
  +		  state().
  +
  +seed(Alg0, S0 = {_, _, _}) ->
  +    seed(Alg0, {mk_alg(Alg0), S0});
  +seed(Alg0, {Alg=#alg{type=Alg0, seed=Seed}, AS0}) ->
       AS = Seed(AS0),
  -    _ = seed_put({Alg, AS}),
  -    {Alg, AS};
  -seed(Alg, AS) when is_record(Alg, alg) ->
       _ = seed_put({Alg, AS}),
       {Alg, AS}.
   
  
positive.code:     {V1, _} = exs64_next(((A1 band ?UINT32MASK) * 4294967197 + 1)),
      {V2, _} = exs64_next(((A2 band ?UINT32MASK) * 4294967231 + 1)),
      {V3, _} = exs64_next(((A3 band ?UINT32MASK) * 4294967279 + 1)),
      ((V1 * V2 * V3) rem (?UINT64MASK - 1)) + 1.
  
  %% {uniform_s, State} -> {F, NewState}:
  %% Generate float from
  
negative.code:       tinymt_seed0(),
        [A1 band ?TINYMT32_UINT32,
         A2 band ?TINYMT32_UINT32,
         A3 band ?TINYMT32_UINT32]);
  tinymt_seed(R0) ->
      tinymt_next_state(R0).
  
  %% Generate 32bit-resolution float from the given TinyMT internal state.
  %% (Note: 0.0 =&lt; result &lt; 1.0)
  