Documentation ¶
Index ¶
- Variables
- func B(n int) []byte
- func D(min, max time.Duration) time.Duration
- func GetDigits(n int) string
- func GetLetters(n int) string
- func GetString(s string, n int) string
- func GetSymbols(n int) string
- func Intn(max int) int
- func Meet(num, total int) bool
- func MeetProb(prob float32) bool
- func N(min, max int) int
- func Perm(n int) []int
- func S(n int, symbols ...bool) string
- type Str
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" // 52 UpperLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" // 26 LowerLetters = "abcdefghijklmnopqrstuvwxyz" // 26 Symbols = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~" // 32 Digits = "0123456789" // 10 )
Functions ¶
func GetDigits ¶ added in v2.4.5
GetDigits returns a random str which contains only digits, and its length is `n`.
func GetLetters ¶ added in v2.4.5
GetLetters returns a random str which contains only letters, and its length is `n`.
func GetString ¶ added in v2.4.5
GetString randomly picks and returns `n` count of chars from given str `s`. It also supports unicode str like Chinese/Russian/Japanese, etc.
func GetSymbols ¶ added in v2.4.5
GetSymbols returns a random str which contains only symbols, and its length is `n`.
func N ¶
N returns a random int between min and max: [min, max]. The `min` and `max` also support negative numbers.
Types ¶
Click to show internal directories.
Click to hide internal directories.