repeat

package
v0.0.0-...-c730260 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Seed

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

Seed is represents anything that starts and Ends

func NewSeed

func NewSeed(seed time.Time) *Seed

NewSeed creates a new seed and specifies the seed Used to replay Past Patterns

func (*Seed) Chance

func (s *Seed) Chance(prospect float64) bool

Chance is an idempotent call based on a time and a prospect in the range (1, 0) it will return true if the result of a fast hash of the time is above a certain percentage (chance) of possible hash values

func (*Seed) NextSeed

func (s *Seed) NextSeed() time.Time

NextSeed provides a unique time for seeding repeatable, random operations

func (*Seed) Option

func (s *Seed) Option(options int) int

Option is an idempotent call based on a time and a number of options If the result of a fast hash of the time is within a certain option-range of possible hash values, it will return that option

func (*Seed) RandDuration

func (s *Seed) RandDuration(min, max time.Duration) time.Duration

RandDuration is an idempotent call based on a time and a range of durations it will return a random duration from within that range

func (*Seed) RandShift

func (s *Seed) RandShift(min, max, unit float64) float64

RandShift is an idempotent call based on a time and a range of shifts it will return a random shift from within that range unit provides the granularity of the randomness

Jump to

Keyboard shortcuts

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