random

package
v0.0.0-...-18e7427 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateUniqueSeed

func GenerateUniqueSeed() int64

GenerateUniqueSeed generates a unique seed.

func Stafford13

func Stafford13(seed int64) int64

Types

type LegacyRandomSource

type LegacyRandomSource struct {
	RandomSource
	// contains filtered or unexported fields
}

func NewLegacyRandomSource

func NewLegacyRandomSource(seed int64) *LegacyRandomSource

func NewLegacyRandomSourceAt

func NewLegacyRandomSourceAt(x, y, z int32, seed int64) *LegacyRandomSource

func (*LegacyRandomSource) Next

func (l *LegacyRandomSource) Next(bits int) int

func (*LegacyRandomSource) NextBoolean

func (l *LegacyRandomSource) NextBoolean() bool

func (*LegacyRandomSource) NextDouble

func (l *LegacyRandomSource) NextDouble() float64

func (*LegacyRandomSource) NextFloat

func (l *LegacyRandomSource) NextFloat() float32

func (*LegacyRandomSource) NextGaussian

func (l *LegacyRandomSource) NextGaussian() float64

func (*LegacyRandomSource) NextInt

func (l *LegacyRandomSource) NextInt(n int) int

func (*LegacyRandomSource) NextLong

func (l *LegacyRandomSource) NextLong() int64

func (*LegacyRandomSource) SetSeed

func (l *LegacyRandomSource) SetSeed(seed int64)

type MarsagliaPolarGaussian

type MarsagliaPolarGaussian struct {
	Source RandomSource
	// contains filtered or unexported fields
}

func NewMarsagliaPolarGaussian

func NewMarsagliaPolarGaussian(source RandomSource) *MarsagliaPolarGaussian

func (*MarsagliaPolarGaussian) Next

func (m *MarsagliaPolarGaussian) Next() float64

func (*MarsagliaPolarGaussian) Reset

func (m *MarsagliaPolarGaussian) Reset()

type RandomSource

type RandomSource interface {
	SetSeed(seed int64)
	Next(bits int) int
	NextInt(n int) int
	NextLong() int64
	NextBoolean() bool
	NextFloat() float32
	NextDouble() float64
	NextGaussian() float64
}

type Seed128

type Seed128 [2]int64

func UpgradeSeed

func UpgradeSeed(seed int64) Seed128

UpgradeSeed takes a int64 seed and transforms it into a Seed128

type WorldGenRandom

type WorldGenRandom struct {
	*LegacyRandomSource
	// contains filtered or unexported fields
}

func NewWorldGeneration

func NewWorldGeneration(source RandomSource) *WorldGenRandom

func (*WorldGenRandom) Next

func (w *WorldGenRandom) Next(bits int) int

func (*WorldGenRandom) SeedSlimeChunk

func (w *WorldGenRandom) SeedSlimeChunk(x, z, salt int32) RandomSource

func (*WorldGenRandom) SetDecoration

func (w *WorldGenRandom) SetDecoration(seed int64, x, z int32)

func (*WorldGenRandom) SetFeature

func (w *WorldGenRandom) SetFeature(seed int64, x, z int32)

func (*WorldGenRandom) SetLargeFeature

func (w *WorldGenRandom) SetLargeFeature(seed int64, x, z int32)

func (*WorldGenRandom) SetLargeFeatureSalt

func (w *WorldGenRandom) SetLargeFeatureSalt(seed int64, x, z, salt int32)

func (*WorldGenRandom) SetSeed

func (w *WorldGenRandom) SetSeed(seed int64)

type Xoroshiro128

type Xoroshiro128 Seed128

func NewXoroshiro128

func NewXoroshiro128(seed Seed128) *Xoroshiro128

func (*Xoroshiro128) Next

func (x *Xoroshiro128) Next() int64

type XoroshiroSource

type XoroshiroSource struct {
	RandomSource
	// contains filtered or unexported fields
}

func NewXoroshiroRandomSource

func NewXoroshiroRandomSource(seed int64) *XoroshiroSource

func NewXoroshiroRandomSourceAt

func NewXoroshiroRandomSourceAt(x, y, z int32, seed int64) *XoroshiroSource

func (*XoroshiroSource) NextBoolean

func (x *XoroshiroSource) NextBoolean() bool

func (*XoroshiroSource) NextDouble

func (x *XoroshiroSource) NextDouble() float64

func (*XoroshiroSource) NextFloat

func (x *XoroshiroSource) NextFloat() float32

func (*XoroshiroSource) NextGaussian

func (x *XoroshiroSource) NextGaussian() float64

func (*XoroshiroSource) NextInt

func (x *XoroshiroSource) NextInt(bits int) int

func (*XoroshiroSource) NextLong

func (x *XoroshiroSource) NextLong() int64

func (*XoroshiroSource) SetSeed

func (x *XoroshiroSource) SetSeed(seed int64)

Jump to

Keyboard shortcuts

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