stream_seed Function

private pure function stream_seed(master_seed, stream_id) result(s)

Deterministic seed for stream_id under master_seed.

mix64 is applied to the master seed, the stream id is spread over the whole word by multiplying stream_id + 1 by the golden-ratio constant, the two are combined with ieor, and the result is mixed once more. Adding one to the id keeps stream 0 from collapsing the multiplication to zero. Only bit-model and modular arithmetic is used, so the mapping is identical on every compiler.

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(in) :: master_seed
integer(kind=default_int), intent(in) :: stream_id

Return Value integer(kind=int64)


Calls

proc~~stream_seed~~CallsGraph proc~stream_seed stream_seed proc~mix64 mix64 proc~stream_seed->proc~mix64 proc~u64_add u64_add proc~stream_seed->proc~u64_add proc~u64_mul u64_mul proc~stream_seed->proc~u64_mul proc~mix64->proc~u64_mul proc~u64_shr u64_shr proc~mix64->proc~u64_shr

Called by

proc~~stream_seed~~CalledByGraph proc~stream_seed stream_seed proc~stream_for_pcg32 stream_for_pcg32 proc~stream_for_pcg32->proc~stream_seed proc~stream_for_splitmix64 stream_for_splitmix64 proc~stream_for_splitmix64->proc~stream_seed interface~stream_for stream_for interface~stream_for->proc~stream_for_pcg32 interface~stream_for->proc~stream_for_splitmix64

Source Code

   pure function stream_seed(master_seed, stream_id) result(s)
      !! Deterministic seed for `stream_id` under `master_seed`.
      !!
      !! `mix64` is applied to the master seed, the stream id is spread over the
      !! whole word by multiplying `stream_id + 1` by the golden-ratio constant,
      !! the two are combined with `ieor`, and the result is mixed once more.
      !! Adding one to the id keeps stream 0 from collapsing the multiplication
      !! to zero. Only bit-model and modular arithmetic is used, so the mapping
      !! is identical on every compiler.
      integer(int64), intent(in) :: master_seed
      integer(default_int), intent(in) :: stream_id
      integer(int64) :: s

      s = mix64(ieor(mix64(master_seed), &
                     u64_mul(u64_add(int(stream_id, int64), 1_int64), GOLDEN_GAMMA)))
   end function stream_seed