Documentation ¶
Overview ¶
Package extrand extend rand
Index ¶
- Variables
- func AlphaNumber(length int) string
- func AlphaNumberBytes(length int) []byte
- func Alphabet(length int) string
- func AlphabetBytes(length int) []byte
- func Bytes(length int, alphabets ...byte) []byte
- func Float32() float32
- func Float64() float64
- func Float64x(min, max float64) float64
- func Int() int
- func Int31() int32
- func Int31n(n int32) int32
- func Int31x(min, max int32) int32
- func Int63() int64
- func Int63n(n int64) int64
- func Int63x(min, max int64) int64
- func Intn(n int) int
- func Intx(min, max int) int
- func Number(length int) string
- func NumberBytes(length int) []byte
- func Perm(n int) []int
- func String(length int, alphabets ...byte) string
- func Symbol(length int) string
- func SymbolBytes(length int) []byte
- func Uint32() uint32
- func Uint64() uint64
Constants ¶
This section is empty.
Variables ¶
var ( DefaultAlphabet = []byte("QWERTYUIOPLKJHGFDSAZXCVBNMabcdefghijklmnopqrstuvwxyz") DefaultDigit = []byte("0123456789") DefaultAlphaDigit = []byte("QWERTYUIOPLKJHGFDSAZXCVBNMabcdefghijklmnopqrstuvwxyz0123456789") DefaultSymbol = []byte("QWERTYUIOPLKJHGFDSAZXCVBNMabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_{|}~`") )
previous defined bytes
Functions ¶
func AlphaNumber ¶ added in v0.3.1
AlphaNumber rand string with give length(只包含字母, 数字)
func AlphaNumberBytes ¶ added in v0.3.1
AlphaNumberBytes rand string with give length(只包含字母, 数字)
func AlphabetBytes ¶ added in v0.3.0
AlphabetBytes rand alpha with give length(只包含字母)
func Float32 ¶ added in v0.2.3
func Float32() float32
Float32 returns, as a float32, a pseudo-random number in [0.0,1.0).
func Float64 ¶
func Float64() float64
Float64 returns, as a float64, a pseudo-random number in [0.0,1.0).
func Int31 ¶
func Int31() int32
Int31 returns a non-negative pseudo-random 31-bit integer as an int32.
func Int31n ¶ added in v0.2.3
Int31n returns, as an int32, a non-negative pseudo-random number in [0,n). It panics if n <= 0.
func Int63 ¶
func Int63() int64
Int63 returns a non-negative pseudo-random 63-bit integer as an int64.
func Int63n ¶ added in v0.2.3
Int63n returns, as an int64, a non-negative pseudo-random number in [0,n). It panics if n <= 0.
func Intn ¶ added in v0.2.3
Intn returns, as an int, a non-negative pseudo-random number in [0,n). It panics if n <= 0.
func NumberBytes ¶ added in v0.3.1
NumberBytes rand string with give length(只包含数字)
func Perm ¶ added in v0.2.3
Perm returns, as a slice of n ints, a pseudo-random permutation of the integers [0,n).
func SymbolBytes ¶ added in v0.3.0
SymbolBytes rand symbol with give length(只包含字母, 数字, 特殊符号)
Types ¶
This section is empty.