splitmix64

package
v0.0.0-...-d740340 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 4, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package splitmix64 implements SplitMix64 pseudo-random number gnerator.

SplitMix64 is a very fast generator passing BigCrush with 64-bits of state.

References:

http://xoroshiro.di.unimi.it/splitmix64.c - Written by Sebastiano Vigna

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SplitMix64

type SplitMix64 struct {
	// contains filtered or unexported fields
}

SplitMix64 implements the avalanching function based PRNG by Sebastiano Vigna

func New

func New(seed uint64) *SplitMix64

New returns a new instance of the SplitMix64 PRNG Engine. If the seed provided is 0, the engine is initialized with current time

func (*SplitMix64) Float64

func (s *SplitMix64) Float64() float64

Float64 returns a pseudo-random number in [0.0, 1.0) as a float64. Float64 advances the internal state of the engine.

func (*SplitMix64) Float64OO

func (s *SplitMix64) Float64OO() float64

Float64OO returns a pseudo-random number in (0.0, 1.0) as a float64. Float6400 advances the internal state of the engine.

func (*SplitMix64) GetSeed

func (s *SplitMix64) GetSeed() uint64

GetSeed returns the seed used to initialize the engine

func (*SplitMix64) GetState

func (s *SplitMix64) GetState() []byte

GetState returns the internal state of the engine as []byte GetState can be used to save the state, e.g. to a file

func (*SplitMix64) Reset

func (s *SplitMix64) Reset()

Reset reverts the internal state of the engine to its default state, except the seed

func (*SplitMix64) Seed

func (s *SplitMix64) Seed(seed uint64)

Seed uses the provided value to initialize the engine

func (*SplitMix64) SetState

func (s *SplitMix64) SetState(b []byte)

SetState sets the internal state of the engine from a []byte SetState can be used to resume from a saved state

func (*SplitMix64) Uint64

func (s *SplitMix64) Uint64() uint64

Uint64 returns a pseudo-random 64-bit value in [0, 2^64) as a uint64. Uint64 advances the internal state of the engine.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL