splitmix64_t Derived Type

type, public :: splitmix64_t

SplitMix64 generator: a 64-bit counter run through a strong finaliser.


Components

Type Visibility Attributes Name Initial
integer(kind=int64), public :: state = 0_int64

Explicit 64-bit state. Fixed width on purpose: the algorithm is defined on 64-bit words and must not follow default_int.


Type-Bound Procedures

procedure, public :: next => splitmix64_next

  • private function splitmix64_next(self) result(r)

    Advance the state by the golden-ratio increment and return the mixed 64-bit output.

    Arguments

    Type IntentOptional Attributes Name
    class(splitmix64_t), intent(inout) :: self

    Return Value integer(kind=int64)

procedure, public :: next_u64 => splitmix64_next_u64

  • private function splitmix64_next_u64(self) result(r)

    Full 64-bit random word. For SplitMix64 this is simply next; it exists so that both engines present the same interface to the shared real and bounded-integer conversions.

    Arguments

    Type IntentOptional Attributes Name
    class(splitmix64_t), intent(inout) :: self

    Return Value integer(kind=int64)

procedure, public :: seed => splitmix64_seed

  • private subroutine splitmix64_seed(self, s)

    Set the generator state. Any 64-bit value is a valid seed, including zero: SplitMix64 has no degenerate state.

    Arguments

    Type IntentOptional Attributes Name
    class(splitmix64_t), intent(inout) :: self
    integer(kind=int64), intent(in) :: s

Source Code

   type :: splitmix64_t
      !! SplitMix64 generator: a 64-bit counter run through a strong finaliser.
      integer(int64) :: state = 0_int64
         !! Explicit 64-bit state. Fixed width on purpose: the algorithm is
         !! defined on 64-bit words and must not follow `default_int`.
   contains
      procedure :: seed => splitmix64_seed
      procedure :: next => splitmix64_next
      procedure :: next_u64 => splitmix64_next_u64
   end type splitmix64_t