random

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2021 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package random is a helper for generating random alphanumeric strings.

Index

Constants

This section is empty.

Variables

View Source
var (
	PossibleNumbers          = "0123456789"
	PossibleLowerCase        = "abcdefghijklmnopqrstuvwxyz"
	PossibleUpperCase        = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	PossibleSpecialCharacter = " !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"

	PossibleAlphaNum      = PossibleNumbers + PossibleLowerCase + PossibleUpperCase
	PossibleAlphaNumLower = PossibleNumbers + PossibleLowerCase
	PossibleAlphaNumUpper = PossibleNumbers + PossibleUpperCase
)

Functions

func AlphaNum

func AlphaNum(length int) string

AlphaNum returns a random alphanumeric string of the given length. The returned string can contain both uppercase and lowercase letters.

func AlphaNumLower

func AlphaNumLower(length int) string

AlphaNumLower returns a random alphanumeric string of the given length. The returned string can contain lowercase letters, but not uppercase.

func AlphaNumUpper

func AlphaNumUpper(length int) string

AlphaNumUpper returns a random alphanumeric string of the given length. The returned string can contain uppercase letters, but not lowercase.

func Numbers

func Numbers(length int) string

Numbers returns a random numeric string of the given length

func String

func String(chooseFrom string, length int) (randomString string)

String returns a random string of the given length, using only the component characters provided in the "chooseFrom" string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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