rand

package
v0.0.0-...-2083224 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CharsNum contains numbers from 0-9
	CharsNum = "0123456789"
	// CharsAlpha contains the full English alphabet: letters a-z and A-Z
	CharsAlpha = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
	// CharsAlphaNum is a combination of CharsNum and CharsAlpha
	CharsAlphaNum = CharsNum + CharsAlpha
	// CharsASCII contains all printable ASCII characters in code range [32, 126]
	CharsASCII = CharsAlphaNum + " !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
)

Variables

View Source
var (
	// ErrInvalidLengthSpecified is returned when the length specified is invalid
	ErrInvalidLengthSpecified = errors.New("invalid password length specified")
	// ErrInvalidDictSpecified is returned when the dictionary specified is invalid
	ErrInvalidDictSpecified = errors.New("invalid password dictionary specified")
)

Functions

func Gen6Number

func Gen6Number() string

Gen6Number gen 6 rand number

func Generate

func Generate(l int, dict string) (string, error)

Generate generates a cryptographically secure and unbiased string of length 'l' using alphabet 'dict'

func GetBase32String

func GetBase32String(num int) string

GetBase32String 生成Base32随机字符串

func GetRandomItNum

func GetRandomItNum(num int) int

GetRandomItNum 返回输入参数以下的随机数字,如输入参数为5,随机返回1,2,3,4,5

func GetRandomNumber

func GetRandomNumber(num int) string

GetRandomNumber 生成随机数字字符串

func GetRandomString

func GetRandomString(num int) string

GetRandomString 生成随机字符串

func RedPackage

func RedPackage(count int, money int64) []int64

RedPackage 发红包 count: 红包数量 money: 红包金额(单位:分)

func Shuffle

func Shuffle(arr []int64)

Shuffle 洗牌算法

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL