random

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 大写字母
	TypeCAPITAL RandType = 1
	// 小写字母
	TypeLOWERCASE = TypeCAPITAL << 1
	// 数字
	TypeNUMBERIC = TypeCAPITAL << 2
	// 所有
	TypeALL = TypeCAPITAL | TypeLOWERCASE | TypeNUMBERIC
)
View Source
const (
	StrNumberic  = `0123456789`
	StrLowercase = `abcdefghijklmnopqrstuvwxyz`
	StrCapital   = `ABCDEFGHIJKLMNOPQRSTUVWXYZ`
)

Variables

This section is empty.

Functions

func FisherYates

func FisherYates(arr []string) []string

FisherYates 洗牌算法,确保已经 seed 种子

func Rand

func Rand(length int, fill RandType) (res string)

Rand 根据给定字符串类型获取指定长度的随机字符串

func RandBetween

func RandBetween(min, max int) int

RandBetween [min,max]

func RandString

func RandString(length int) string

RandString 随机长度字符串

func RandVariable

func RandVariable(length int) string

RandVariable 随机变量名字,不能以数字开头

func Shuffle

func Shuffle(arg string) (newStr string)

Types

type RandType

type RandType int

RandType ...

func GetRandTypeList

func GetRandTypeList() []RandType

GetRandTypeList 获取给定的字符串类型列表

func (RandType) String

func (rt RandType) String() string

Jump to

Keyboard shortcuts

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