xoshiro256starstar

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: 5 Imported by: 0

Documentation

Overview

Package xoshiro256starstar implements the Xoshiro256** random number generator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SafeXoshiro256StarStar

type SafeXoshiro256StarStar struct {
	Xoshiro256StarStar
	// contains filtered or unexported fields
}

SafeXoshiro256StarStar represents the state of a xoshiro256** random number generator with a mutex to make it safe for concurrent use.

func NewSafe

func NewSafe() *SafeXoshiro256StarStar

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

func (*SafeXoshiro256StarStar) Float32

func (x *SafeXoshiro256StarStar) Float32() float32

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

func (*SafeXoshiro256StarStar) Float64

func (x *SafeXoshiro256StarStar) Float64() float64

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

func (*SafeXoshiro256StarStar) Int

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

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

func (*SafeXoshiro256StarStar) Int32

func (x *SafeXoshiro256StarStar) Int32() int32

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

func (*SafeXoshiro256StarStar) Int64

func (x *SafeXoshiro256StarStar) Int64() int64

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

func (*SafeXoshiro256StarStar) Jump

func (x *SafeXoshiro256StarStar) Jump()

Jump advances the internal state by 2^128 calls to Next(), which is safe for concurrent use.

func (*SafeXoshiro256StarStar) LongJump

func (x *SafeXoshiro256StarStar) LongJump()

LongJump advances the internal state by 2^192 calls to Next(), which is safe for concurrent use.

func (*SafeXoshiro256StarStar) Marshal

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

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

func (*SafeXoshiro256StarStar) Reset

func (x *SafeXoshiro256StarStar) Reset()

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

func (*SafeXoshiro256StarStar) Seed

func (x *SafeXoshiro256StarStar) Seed(seed uint64)

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

func (*SafeXoshiro256StarStar) State

func (x *SafeXoshiro256StarStar) State() [4]uint64

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

func (*SafeXoshiro256StarStar) Uint32

func (x *SafeXoshiro256StarStar) Uint32() uint32

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

func (*SafeXoshiro256StarStar) Uint64

func (x *SafeXoshiro256StarStar) Uint64() uint64

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

func (*SafeXoshiro256StarStar) Unmarshal

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

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

type Xoshiro256StarStar

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

Xoshiro256StarStar represents the state of a xoshiro256** random number generator.

func New

func New() *Xoshiro256StarStar

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

func (*Xoshiro256StarStar) Float32

func (x *Xoshiro256StarStar) Float32() float32

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

func (*Xoshiro256StarStar) Float64

func (x *Xoshiro256StarStar) Float64() float64

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

func (*Xoshiro256StarStar) Int

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

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

func (*Xoshiro256StarStar) Int32

func (x *Xoshiro256StarStar) Int32() int32

go:inline Int32 generates a random 32-bit signed integer.

func (*Xoshiro256StarStar) Int64

func (x *Xoshiro256StarStar) Int64() int64

go:inline Int64 generates a random 64-bit signed integer.

func (*Xoshiro256StarStar) Jump

func (x *Xoshiro256StarStar) Jump()

Jump advances the internal state by 2^128 calls to Next().

func (*Xoshiro256StarStar) LongJump

func (x *Xoshiro256StarStar) LongJump()

LongJump advances the internal state by 2^192 calls to Next().

func (*Xoshiro256StarStar) Marshal

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

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

func (*Xoshiro256StarStar) Reset

func (x *Xoshiro256StarStar) Reset()

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

func (*Xoshiro256StarStar) Seed

func (x *Xoshiro256StarStar) Seed(seed uint64)

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

func (*Xoshiro256StarStar) State

func (x *Xoshiro256StarStar) State() [4]uint64

State returns the current state of the random number generator.

func (*Xoshiro256StarStar) Uint32

func (x *Xoshiro256StarStar) Uint32() uint32

go:inline Uint32 generates a random 32-bit unsigned integer.

func (*Xoshiro256StarStar) Uint64

func (x *Xoshiro256StarStar) Uint64() uint64

Uint64 generates a random 64-bit unsigned integer.

func (*Xoshiro256StarStar) Unmarshal

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

UnmarshalBinary 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