rng

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandomSeed

func RandomSeed() string

RandomSeed generates a random seed.

Types

type RNG

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

RNG can be used to generate random values.

func NewRNG

func NewRNG(seed string) (*RNG, error)

NewRNG creates a new RNG based on either a given seed or a randomly generated one.

func (*RNG) Float

func (rng *RNG) Float() float64

Float returns a random float between 0 (inclusive) and 1 (exclusive).

func (*RNG) IntBetween

func (rng *RNG) IntBetween(lowerBound, upperBound int) int

IntBetween returns a random integer value between lower and upper bounds, inclusive.

func (*RNG) Seed

func (rng *RNG) Seed() string

Seed returns the RNG seed.

Jump to

Keyboard shortcuts

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