random

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2021 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64

func Base64(n int) string

Base64 generates a random base64 string with length of n

func Bytes

func Bytes(n int) []byte

Bytes generates n random bytes

func Hex

func Hex(n int) string

Hex generates a random hex string with length of n e.g: 67aab2d956bd7cc621af22cfb169cba8

Example
for i := 0; i < 5; i++ {
	token := Hex(16)
	fmt.Println(token)
}
Output:

func String

func String(n int, letters ...string) string

String generates a random string using only letters provided in the letters parameter if user ommit letters parameters, this function will use defLetters instead

Example
for i := 0; i < 5; i++ {
	token := String(16)
	fmt.Println(token)
}
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

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