splitmix64

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: Unlicense Imports: 4 Imported by: 0

Documentation

Overview

Package splitmix64 implements the SplitMix64 random number generator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SafeSplitMix64

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

SafeSplitMix64 represents the state of a SplitMix64 random number generator with a mutex to make it safe for concurrent use.

func NewSafe

func NewSafe() *SafeSplitMix64

NewSafe creates a new safe SplitMix64 instance seeded with the current time.

func (*SafeSplitMix64) Float32

func (x *SafeSplitMix64) Float32() float32

Float32 generates a random float32 in the range [0.0, 1.0), which is safe for concurrent use.

func (*SafeSplitMix64) Float64

func (x *SafeSplitMix64) Float64() float64

Float64 generates a random float64 in the range [0.0, 1.0), which is safe for concurrent use.

func (*SafeSplitMix64) Int

func (x *SafeSplitMix64) Int(n int) int

Int generates a random integer in the range [0, n), which is safe for concurrent use.

func (*SafeSplitMix64) Int32

func (x *SafeSplitMix64) Int32() int32

Int32 generates a random 32-bit signed integer, which is safe for concurrent use.

func (*SafeSplitMix64) Int64

func (x *SafeSplitMix64) Int64() int64

Int64 generates a random 64-bit signed integer, which is safe for concurrent use.

func (*SafeSplitMix64) Marshal

func (x *SafeSplitMix64) Marshal() ([]byte, error)

Marshal returns the binary encoding of the current state of the random number generator, which is safe for concurrent use.

func (*SafeSplitMix64) Reset

func (x *SafeSplitMix64) Reset()

Reset resets the state of the random number generator to the seed value, which is safe for concurrent use.

func (*SafeSplitMix64) Seed

func (x *SafeSplitMix64) Seed(seed uint64)

Seed initializes the state of the random number generator with the given seed value, which is safe for concurrent use.

func (*SafeSplitMix64) State

func (x *SafeSplitMix64) State() uint64

State returns the current state of the random number generator, which is safe for concurrent use.

func (*SafeSplitMix64) Uint32

func (x *SafeSplitMix64) Uint32() uint32

Uint32 generates a random 32-bit unsigned integer, which is safe for concurrent use.

func (*SafeSplitMix64) Uint64

func (x *SafeSplitMix64) Uint64() uint64

Uint64 generates a random 64-bit unsigned integer, which is safe for concurrent use.

func (*SafeSplitMix64) Unmarshal

func (x *SafeSplitMix64) Unmarshal(data []byte) error

Unmarshal sets the state of the random number generator to the state represented by the input data, which is safe for concurrent use.

type SplitMix64

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

SplitMix64 represents the state of a SplitMix64 random number generator.

func New

func New() *SplitMix64

New creates a new SplitMix64 instance seeded with the current time.

func (*SplitMix64) Float32

func (x *SplitMix64) Float32() float32

Float32 generates a random float32 in the range [0.0, 1.0).

func (*SplitMix64) Float64

func (x *SplitMix64) Float64() float64

Float64 generates a random float64 in the range [0.0, 1.0).

func (*SplitMix64) Int

func (x *SplitMix64) Int(n int) int

Int generates a random integer in the range [0, n).

func (*SplitMix64) Int32

func (x *SplitMix64) Int32() int32

Int32 generates a random 32-bit signed integer.

func (*SplitMix64) Int64

func (x *SplitMix64) Int64() int64

Int64 generates a random 64-bit signed integer.

func (*SplitMix64) Marshal

func (x *SplitMix64) Marshal() ([]byte, error)

Marshal returns the binary encoding of the current state of the random number generator.

func (*SplitMix64) Reset

func (x *SplitMix64) Reset()

Reset resets the state of the random number generator to the seed value.

func (*SplitMix64) Seed

func (x *SplitMix64) Seed(seed uint64)

Seed initializes the state of the random number generator with the given seed value.

func (*SplitMix64) State

func (x *SplitMix64) State() uint64

State returns the current state of the random number generator.

func (*SplitMix64) Uint32

func (x *SplitMix64) Uint32() uint32

Uint32 generates a random 32-bit unsigned integer.

func (*SplitMix64) Uint64

func (x *SplitMix64) Uint64() uint64

Uint64 generates a random 64-bit unsigned integer.

func (*SplitMix64) Unmarshal

func (x *SplitMix64) Unmarshal(data []byte) error

Unmarshal sets the state of the random number generator to the state represented by the input data.

Jump to

Keyboard shortcuts

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