Documentation ¶
Index ¶
- func GetPredictableSeed(instance, session int) int64
- func GetPredictableSeedUInt64(instance, session uint64) int64
- type Randomizer
- func (rnd *Randomizer) Float64() float64
- func (rnd *Randomizer) Rand(max int) int
- func (rnd *Randomizer) Rand32(max int32) int32
- func (rnd *Randomizer) RandBytes(size int) ([]byte, error)
- func (rnd *Randomizer) RandDuration(minDuration, maxDuration time.Duration) (time.Duration, error)
- func (rnd *Randomizer) RandInt(ints []int) (int, error)
- func (rnd *Randomizer) RandIntPos(ints []int) (int, int, error)
- func (rnd *Randomizer) RandRune(runes []rune) rune
- func (rnd *Randomizer) RandString(strings []string) (string, error)
- func (rnd *Randomizer) RandWeighted(w []Weighted) (string, error)
- func (rnd *Randomizer) RandWeightedInt(weights []int) (int, error)
- type Weighted
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPredictableSeed ¶
GetPredictableSeed Get predictable seed for instance session combination, to be used for randomizers in testing and trend measurements
func GetPredictableSeedUInt64 ¶
GetPredictableSeedUInt64 Get predictable seed for instance session combination, to be used for randomizers in testing and trend measurements
Types ¶
type Randomizer ¶
type Randomizer struct {
// contains filtered or unexported fields
}
Randomizer overlord randomizer
func NewRandomizer ¶
func NewRandomizer() *Randomizer
NewRandomizer new randomizer seeded with time.now
func NewSeededRandomizer ¶
func NewSeededRandomizer(seed int64) *Randomizer
NewSeededRandomizer new seeded randomizer
func (*Randomizer) Float64 ¶ added in v0.14.12
func (rnd *Randomizer) Float64() float64
Float64 returns, as a float64, a pseudo-random number in the half-open interval [0.0,1.0).
func (*Randomizer) Rand ¶
func (rnd *Randomizer) Rand(max int) int
Rand returns result from Intn using current randomizer instance
func (*Randomizer) Rand32 ¶
func (rnd *Randomizer) Rand32(max int32) int32
Rand32 returns result from Int32n using current randomizer instance
func (*Randomizer) RandBytes ¶
func (rnd *Randomizer) RandBytes(size int) ([]byte, error)
RandBytes random byte array
func (*Randomizer) RandDuration ¶
RandDuration random duration up to max
func (*Randomizer) RandInt ¶
func (rnd *Randomizer) RandInt(ints []int) (int, error)
RandInt return random int from list
func (*Randomizer) RandIntPos ¶
func (rnd *Randomizer) RandIntPos(ints []int) (int, int, error)
RandIntPos return random int value and position from list (value, pos)
func (*Randomizer) RandRune ¶ added in v0.14.5
func (rnd *Randomizer) RandRune(runes []rune) rune
RandRune from rune array
func (*Randomizer) RandString ¶
func (rnd *Randomizer) RandString(strings []string) (string, error)
RandString return random string from list
func (*Randomizer) RandWeighted ¶
func (rnd *Randomizer) RandWeighted(w []Weighted) (string, error)
RandWeighted randomize using Weighted interface
func (*Randomizer) RandWeightedInt ¶
func (rnd *Randomizer) RandWeightedInt(weights []int) (int, error)
RandWeightedInt randomize based on weight