Documentation
¶
Index ¶
- Constants
- func Alpha(length int) string
- func AlphaLower(length int) string
- func AlphaUpper(length int) string
- func Bool() bool
- func Bytes(length int) []byte
- func Float64() float64
- func Float64Range(min, max float64) float64
- func Hex(length int) string
- func Int(min, max int) int
- func Int64(min, max int64) int64
- func Numeric(length int) string
- func Password(length int) string
- func Pick[T any](slice []T) T
- func PickN[T any](slice []T, n int) []T
- func SecureBytes(length int) ([]byte, error)
- func SecureString(length int) (string, error)
- func SecureStringWithCharset(length int, charset string) (string, error)
- func Shuffle[T any](slice []T)
- func String(length int) string
- func StringWithCharset(length int, charset string) string
- func Token() string
- func UUID() string
- func UUIDShort() string
- func WeightedPick(weights []int) int
Constants ¶
View Source
const ( // 字符集 CharsetAlphaNum = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" CharsetAlpha = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" CharsetAlphaLower = "abcdefghijklmnopqrstuvwxyz" CharsetAlphaUpper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" CharsetNumeric = "0123456789" CharsetHex = "0123456789abcdef" CharsetSpecial = "!@#$%^&*()_+-=[]{}|;':\",./<>?" )
Variables ¶
This section is empty.
Functions ¶
func Float64Range ¶
Float64Range 生成指定范围内的随机浮点数 [min, max)
func SecureStringWithCharset ¶
SecureStringWithCharset 使用加密安全随机数生成指定字符集的字符串
func StringWithCharset ¶
StringWithCharset 使用指定字符集生成随机字符串
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.