Documentation
¶
Index ¶
- func RandomChoice[T any](items []T) T
- func RandomHex(length int) string
- func RandomInt(minVal, maxVal int64) int64
- func RandomPassword(length int) string
- func RandomString(length int) string
- func RunRandom(w io.Writer, opts RandomOptions) error
- func Shuffle[T any](items []T)
- type RandomOptions
- type RandomResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RandomChoice ¶
func RandomChoice[T any](items []T) T
RandomChoice returns a random element from the slice
func RandomPassword ¶
RandomPassword generates a random password of given length
func RandomString ¶
RandomString generates a random alphanumeric string of given length
Types ¶
type RandomOptions ¶
type RandomOptions struct {
Count int // -n: number of values to generate
Length int // -l: length of random strings
Min int64 // --min: minimum value for numbers
Max int64 // --max: maximum value for numbers
Type string // -t: type (int, float, string, hex, alpha, alnum, bytes)
Charset string // -c: custom character set
Sep string // -s: separator between values
JSON bool // --json: output as JSON
}
RandomOptions configures the random command behavior
type RandomResult ¶
type RandomResult struct {
Type string `json:"type"`
Values []string `json:"values"`
Count int `json:"count"`
}
RandomResult represents random output for JSON
Click to show internal directories.
Click to hide internal directories.