Documentation
¶
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 Float64R(min, max float64) float64
- func Generate(n int) string
- func Int32R(min, max int32) int32
- func Int64R(min, max int64) int64
- func IntR(min, max int) int
- func IsComplexEnough(s string) bool
- func NR[Int intType](min, max Int) Int
- func Number(length int) string
- func NumberBytes(length int) []byte
- func String(length int, alphabets ...byte) string
- func Symbol(length int) string
- func SymbolBytes(length int) []byte
- func Uint32R(min, max uint32) uint32
- func Uint64R(min, max uint64) uint64
- func UintR(min, max uint) uint
- type Complexity
- type Option
Constants ¶
This section is empty.
Variables ¶
var ( DefaultAlphabet = []byte("QWERTYUIOPLKJHGFDSAZXCVBNMabcdefghijklmnopqrstuvwxyz") DefaultDigit = []byte("0123456789") DefaultAlphaDigit = []byte("QWERTYUIOPLKJHGFDSAZXCVBNMabcdefghijklmnopqrstuvwxyz0123456789") DefaultSymbol = []byte("QWERTYUIOPLKJHGFDSAZXCVBNMabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_{|}~`") //nolint: lll )
Previous defined bytes, do not change this.
Functions ¶
func AlphaNumber ¶
AlphaNumber rand string with give length, which Contains number and letters
func AlphaNumberBytes ¶
AlphaNumberBytes rand string with give length, which Contains number and letters
func AlphabetBytes ¶
AlphabetBytes rand alpha with give length, which Contains only letters
func Float64R ¶
Float64R returns, as an float64, a non-negative pseudo-random number in the half-open interval [min,max). It panics if max < min.
func Generate ¶
Generate a random string which is complex enough. which use lower, upper and digit, and meets complexity.
func Int32R ¶
Int32R returns, as an int32, a non-negative pseudo-random number in the half-open interval [min,max). It panics if max < min.
func Int64R ¶
Int64R returns, as an int64, a non-negative pseudo-random number in the half-open interval [min,max). It panics if max < min.
func IntR ¶
IntR returns, as an int, a non-negative pseudo-random number in the half-open interval [min,max). It panics if max < min.
func IsComplexEnough ¶
IsComplexEnough return True if s meets complexity settings. which use lower, upper and digit, and meets complexity.
func NR ¶
func NR[Int intType](min, max Int) Int
NR returns a pseudo-random number in the half-open interval [min,max) from the default Source. The type parameter Int can be any integer type. It panics if max < min.
func NumberBytes ¶
NumberBytes rand string with give length, which Contains only number
func Symbol ¶
Symbol rand symbol with give length, which Contains number, letters and specific symbol
func SymbolBytes ¶
SymbolBytes rand symbol with give length, which Contains number, letters and specific symbol
func Uint32R ¶
Uint32R returns, as an uint32, a non-negative pseudo-random number in the half-open interval [min,max). It panics if max < min.
Types ¶
type Complexity ¶
type Complexity struct {
// contains filtered or unexported fields
}
Complexity setting
func NewComplexity ¶
func NewComplexity(opts ...Option) *Complexity
NewComplexity new complexity with option default use lower, upper and digit to generate a random string, and not meets complexity.
func (*Complexity) Generate ¶
func (sf *Complexity) Generate(n int) string
Generate a random string which is complex enough.
func (*Complexity) IsComplexEnough ¶
func (sf *Complexity) IsComplexEnough(s string) bool
IsComplexEnough return True if s meets complexity settings
type Option ¶
type Option func(*complexityConfig)
Option for Complexity
func WithLowerUpperDigit ¶
func WithLowerUpperDigit() Option
WithLowerUpperDigit use lower upper digit