extrand

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2021 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Overview

Package extrand extend rand

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultAlphabet   = []byte("QWERTYUIOPLKJHGFDSAZXCVBNMabcdefghijklmnopqrstuvwxyz")
	DefaultDigit      = []byte("0123456789")
	DefaultAlphaDigit = []byte("QWERTYUIOPLKJHGFDSAZXCVBNMabcdefghijklmnopqrstuvwxyz0123456789")
	DefaultSymbol     = []byte("QWERTYUIOPLKJHGFDSAZXCVBNMabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_{|}~`")
)

previous defined bytes

Functions

func AlphaNumber added in v0.3.1

func AlphaNumber(length int) string

AlphaNumber rand string with give length(只包含字母, 数字)

func AlphaNumberBytes added in v0.3.1

func AlphaNumberBytes(length int) []byte

AlphaNumberBytes rand string with give length(只包含字母, 数字)

func Alphabet added in v0.3.0

func Alphabet(length int) string

Alphabet rand alpha with give length(只包含字母)

func AlphabetBytes added in v0.3.0

func AlphabetBytes(length int) []byte

AlphabetBytes rand alpha with give length(只包含字母)

func Bytes added in v0.3.0

func Bytes(length int, alphabets ...byte) []byte

Bytes rand bytes(如果没有给出alphabets,将使用 DefaultAlphabet)

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 Float64x added in v0.2.3

func Float64x(min, max float64) float64

Float64x 随机min,max中的值

func Int

func Int() int

Int returns a non-negative pseudo-random int.

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

func Int31n(n int32) int32

Int31n returns, as an int32, a non-negative pseudo-random number in [0,n). It panics if n <= 0.

func Int31x added in v0.2.3

func Int31x(min, max int32) int32

Int31x 随机[min,max)中的值

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

func Int63n(n int64) int64

Int63n returns, as an int64, a non-negative pseudo-random number in [0,n). It panics if n <= 0.

func Int63x added in v0.2.3

func Int63x(min, max int64) int64

Int63x 随机[min,max)中的值

func Intn added in v0.2.3

func Intn(n int) int

Intn returns, as an int, a non-negative pseudo-random number in [0,n). It panics if n <= 0.

func Intx added in v0.2.3

func Intx(min, max int) int

Intx 随机[min,max)中的值

func Number added in v0.3.1

func Number(length int) string

Number rand string with give length(只包含数字)

func NumberBytes added in v0.3.1

func NumberBytes(length int) []byte

NumberBytes rand string with give length(只包含数字)

func Perm added in v0.2.3

func Perm(n int) []int

Perm returns, as a slice of n ints, a pseudo-random permutation of the integers [0,n).

func String added in v0.3.0

func String(length int, alphabets ...byte) string

String rand bytes(如果没有给出alphabets,将使用 DefaultAlphabet)

func Symbol added in v0.2.2

func Symbol(length int) string

Symbol rand symbol with give length(只包含字母, 数字, 特殊符号)

func SymbolBytes added in v0.3.0

func SymbolBytes(length int) []byte

SymbolBytes rand symbol with give length(只包含字母, 数字, 特殊符号)

func Uint32 added in v0.2.3

func Uint32() uint32

Uint32 returns a pseudo-random 32-bit value as a uint32.

func Uint64 added in v0.2.3

func Uint64() uint64

Uint64 returns a non-negative pseudo-random 64-bit integer as an uint64.

Types

This section is empty.

Jump to

Keyboard shortcuts

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