xrand

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 License: MIT Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Digits

func Digits(n int) string

Digits returns a random string which contains only digits, and its length is <n>.

func Intn

func Intn(max int) int

Intn returns a int number which is between 0 and max - [0, max).

Note: 1. The result is greater than or equal to 0, but less than <max>; 2. The result number is 32bit and less than math.MaxUint32.

func Letters

func Letters(n int) string

Letters returns a random string which contains only letters, and its length is <n>.

func Meet

func Meet(num, total int) bool

Meet randomly calculate whether the given probability <num>/<total> is met.

func MeetProb

func MeetProb(prob float32) bool

MeetProb randomly calculate whether the given probability is met.

func N

func N(min, max int) int

N returns a random int between min and max - [min, max].

func Perm

func Perm(n int) []int

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

func Rand

func Rand(min, max int) int

Deprecated. Alias of N.

func RandDigits

func RandDigits(n int) string

Deprecated. Alias of Digits.

func RandLetters

func RandLetters(n int) string

Deprecated. Alias of Letters.

func RandStr

func RandStr(n int) string

Deprecated. Alias of Str.

func Str

func Str(n int) string

Str returns a random string which contains digits and letters, and its length is <n>.

Types

This section is empty.

Jump to

Keyboard shortcuts

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