random

package
v2.1.11 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2022 License: MIT Imports: 5 Imported by: 46

Documentation

Overview

Package random implements some basic functions to generate random int and string.

Index

Constants

View Source
const (
	NUMERAL       = "0123456789"
	LOWER_LETTERS = "abcdefghijklmnopqrstuvwxyz"
	UPPER_LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	LETTERS       = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
)

Variables

This section is empty.

Functions

func RandBytes

func RandBytes(length int) []byte

RandBytes generate random byte slice

func RandInt

func RandInt(min, max int) int

RandInt generate random int between min and max, maybe min, not be max

func RandLower added in v2.1.9

func RandLower(length int) string

RandLower generate a random lower case string

func RandNumeral added in v2.1.9

func RandNumeral(length int) string

RandNumeral generate a random numeral string

func RandNumeralOrLetter added in v2.1.9

func RandNumeralOrLetter(length int) string

RandNumeralOrLetter generate a random numeral or letter string

func RandString

func RandString(length int) string

RandString generate random string

func RandUpper added in v2.1.9

func RandUpper(length int) string

RandUpper generate a random upper case string

func UUIdV4

func UUIdV4() (string, error)

UUIdV4 generate a random UUID of version 4 according to RFC 4122

Types

This section is empty.

Jump to

Keyboard shortcuts

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