anchor.diff:      {V, R1} = random_exs64_next(R0),
       {V / 18446744073709551616.0, R1};
   
  -%% {uniform_s, N, State} -> {I, NewState}
  -%% Given an integer N >= 1, returns a random integer between 1 and N.
  +%% {uniform_s, N, State} -> {I, NewState}:
   %% Generate integer from given xorshift64star internal state.
   %% (Note: 0 =&lt; result &lt; MAX (given positive integer))
   
  
positive.code:     ((V1 * V2 * V3) rem (?UINT64MASK - 1)) + 1;
  
  %% {uniform_s, State} -> {F, NewState}:
  %% Returns a random float between 0 and 1, and new state.
  %% Generate float from
  %% given xorshift64star internal state.
  %% (Note: 0.0 &lt; result &lt; 1.0)
  
negative.code:     {V, R1} = random_exs64_next(R),
      {(V rem Max) + 1, R1}.
  
  %% =====================================================================
  %% exsplus PRNG: Xorshift+128
  %% =====================================================================
  
  %% random_exsplus_state(). Internal state data type for exsplus.
  %% Internally represented as the record <code>#state{}</code>,
  %% of the 128bit seed.
  
  -record(random_exsplus_state, {s0 :: uint64(), s1 :: uint64()}).
  
  -type random_exsplus_state() :: #random_exsplus_state{}.
  
  %% Advance xorshift128plus state for one step.
  %% and generate 64bit unsigned integer from
  %% the xorshift128plus internal state.
  
  -spec random_exsplus_next(random_exsplus_state()) ->
      {uint64(), random_exsplus_state()}.
  
  random_exsplus_next(R) ->
      S1 = R#random_exsplus_state.s0,
      S0 = R#random_exsplus_state.s1,
      S11 = (S1 bxor (S1 bsl 23)) band ?UINT64MASK,
      S12 = S11 bxor S0 bxor (S11 bsr 17) bxor (S0 bsr 26),
      {(S0 + S12) band ?UINT64MASK, 
          #random_exsplus_state{s0 = S0, s1 = S12}}.
  
  %%-----------------------------------------------------------------------
  
  -spec random_exsplus
          (seed0) -> random_exsplus_state();
          ({seed, A1, A2, A3})-> random_exsplus_state() when
                  A1 :: integer(), A2 :: integer(), A3 :: integer();
          ({uniform_s, State0}) -> {float(), State1} when
                  State0 :: random_exsplus_state(),
                  State1 :: random_exsplus_state();
          ({uniform_s, N, State0}) -> {integer(), State1} when
                  N:: pos_integer(),
                  State0 :: random_exsplus_state(),
                  State1 :: random_exsplus_state().
  
  %% seed0: initial PRNG seed
  %% Set the default seed value to xorshift128plus state
  %% in the process directory
  
  random_exsplus(seed0) ->
      #random_exsplus_state{
          s0 = 1234567890123456789, s1 = 9876543210987654321};
  
  %% seed: seeding with three Integers
  %% Set the seed value to xorshift128plus state in the process directory
  %% with the given three unsigned 32-bit integer arguments
  %% Multiplicands here: three 32-bit primes
  
  random_exsplus({seed, A1, A2, A3}) ->
      {_, R1} = random_exsplus_next(
                 #random_exsplus_state{
                     s0 = (((A1 * 4294967197) + 1) band ?UINT64MASK),
                     s1 = (((A2 * 4294967231) + 1) band ?UINT64MASK)}),
      {_, R2} = random_exsplus_next(
                 #random_exsplus_state{
                     s0 = (((A3 * 4294967279) + 1) band ?UINT64MASK),
                     s1 = R1#random_exsplus_state.s1}),
      R2;
  
  %% {uniform_s, State} -> {F, NewState}:
  %% Generate float from
  %% given xorshift128plus internal state.
  %% (Note: 0.0 =&lt; result &lt; 1.0)
  
  random_exsplus({uniform_s, R0}) ->
      {I, R1} = random_exsplus_next(R0),
      {I / 18446744073709551616.0, R1};
  
  %% {uniform_s, N, State} -> {I, NewState}:
  %% Generate integer from given xorshift128plus internal state.
  %% (Note: 0 =&lt; result &lt; MAX (given positive integer))
  
  random_exsplus({uniform_s, Max, R}) when is_integer(Max), Max >= 1 ->
      {V, R1} = random_exsplus_next(R),
      {(V rem Max) + 1, R1}.
  