Documentation ¶
Index ¶
- func AccAddr() sdk.AccAddress
- func Bytes(len int) []byte
- func BytesBetween(lower int, upper int) []byte
- func Coin() sdk.Coin
- func Context(store types.MultiStore) sdk.Context
- func Denom(min, max int) string
- func Duration() time.Duration
- func HexStr(len int) string
- func I64Between(lower int64, upper int64) int64
- func IntBetween(lower sdk.Int, upper sdk.Int) sdk.Int
- func NormalizeString(str string) string
- func NormalizedStr(len int) string
- func NormalizedStrBetween(min, shorterThan int) string
- func Of[T any](items ...T) T
- func PosI64() int64
- func Str(len int) string
- func StrBetween(minLength int, shorterThan int) string
- func ThresholdDec() sdk.Dec
- func UintBetween(lower sdk.Uint, upper sdk.Uint) sdk.Uint
- func ValAddr() sdk.ValAddress
- type BoolGen
- type DistinctStrGen
- type DistrGen
- type I64Gen
- type StringGen
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesBetween ¶
BytesBetween returns a random byte slice of random length in the given limits (upper exclusive)
func Context ¶ added in v0.9.0
func Context(store types.MultiStore) sdk.Context
Context generates a random Context data structure
func I64Between ¶
I64Between returns a random integer between lower (inclusive) and upper (exclusive). It panics if upper <= lower.
func IntBetween ¶ added in v0.27.0
IntBetween returns a random integer between lower (inclusive) and upper (exclusive). It panics if upper <= lower or if (upper - lower) doesn't fit int64.
func NormalizeString ¶ added in v0.12.0
NormalizeString normalizes a string as NFKC
func NormalizedStr ¶ added in v0.12.0
NormalizedStr creates a random normalized string of the provided length
func NormalizedStrBetween ¶ added in v0.12.0
NormalizedStrBetween creates a random normalized string in the provided range (exclusive uper limit)
func Of ¶ added in v0.17.0
func Of[T any](items ...T) T
Of returns a random item from the given slice
func StrBetween ¶
StrBetween returns a random string of random length in the given limits (upper exclusive)
func ThresholdDec ¶ added in v0.33.1
func UintBetween ¶ added in v0.21.0
UintBetween returns a random integer between lower (inclusive) and upper (exclusive). It panics if upper <= loweror or if (upper - lower) doesn't fit int64.
Types ¶
type BoolGen ¶
type BoolGen struct {
// contains filtered or unexported fields
}
BoolGen represents an random bool generator. Call Stop when done so dangling goroutines can be cleaned up.
type DistinctStrGen ¶
type DistinctStrGen struct { StringGen // contains filtered or unexported fields }
DistinctStrGen represents an random string generator which returns distinct strings. Call Stop when done so dangling goroutines can be cleaned up.
func (DistinctStrGen) Next ¶
func (g DistinctStrGen) Next() string
Next returns a single random string that is distinct from all previously generated strings.
func (DistinctStrGen) Take ¶
func (g DistinctStrGen) Take(count int) []string
Take returns a slice of distinct random strings of the given length.
type DistrGen ¶
type DistrGen struct {
// contains filtered or unexported fields
}
DistrGen represents a probability distribution that can be sampled
type I64Gen ¶
type I64Gen struct {
// contains filtered or unexported fields
}
I64Gen represents an random integer generator to generate a sequence of integers with the same properties. Call Stop when done so dangling goroutines can be cleaned up.
func I64GenBetween ¶
I64GenBetween returns a random integer generator for numbers between lower (inclusive) and upper (exclusive). It panics if upper <= lower.
func PInt64Gen ¶
func PInt64Gen() I64Gen
PInt64Gen returns a random integer generator for positive integers.
type StringGen ¶
type StringGen struct {
// contains filtered or unexported fields
}
StringGen represents an random string generator. Call Stop when done so dangling goroutines can be cleaned up.
func HexStrings ¶
HexStrings returns a random hex string generator that produces hex strings with given length
func Strings ¶
Strings returns a random string generator that produces strings from the default alphabet of random length in the given limits (upper limit exclusive)
func (StringGen) Distinct ¶
func (g StringGen) Distinct() DistinctStrGen
Distinct returns a new unique string
func (StringGen) WithAlphabet ¶
WithAlphabet returns a random string generator that produces strings from the given alphabet