program rand;
{$IF Defined(FPC)}{$MODE Delphi}{$ENDIF}
{$INLINE ON}
{$Q-}{$R-}

uses SysUtils;

type
  TSplitMix64 = record
    state: UInt64;
    procedure Init(seed: UInt64); inline;
    function Next(): UInt64; inline;
  end;

procedure TSplitMix64.Init(seed: UInt64);
begin
  state := seed;
end;

function TSplitMix64.Next(): UInt64;
begin
  Inc(state, $9e3779b97f4a7c15);
  Result := state;
  Result := (Result xor (Result shr 30)) * $bf58476d1ce4e5b9;
  Result := (Result xor (Result shr 27)) * $94d049bb133111eb;
  Result := Result xor (Result shr 31);
end;

const
  check: UInt64 = $FFFFFFFFFFFFFFFF shr 8;

var
  r: TSplitMix64;
  x: UInt64;
  i, c: integer;

begin
  r.Init(UInt64(GetTickCount()) * UInt64(GetTickCount()));

  for i := 0 to 1000000000 do
  begin
    x := r.Next();
    if x < check then Inc(c);
  end;    
  WriteLn(c, ' values < ', check);
  for i := 0 to 1000 do
    WriteLn(r.Next());
end.