randomstring

package
v0.0.0-...-550751b Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2023 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	LatinUpper   = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	LatinLower   = "abcdefghijklmnopqrstuvwxyz"
	Latin        = LatinUpper + LatinLower
	Decimal      = "0123456789"
	Hexadecimal  = Decimal + "ABCDEF"
	Alphanumeric = Latin + Decimal
	Punctuation  = ",.:;!?-"
	Bracket      = "{}[]()"
	SpecCharsKbd = "`~!@#$%^&*()|"
)

Variables

This section is empty.

Functions

func FromSet

func FromSet(set string, length int, rnd *rand.Rand) string

FromSet returns a random string built of runes from a set provided

func NonEmptyUTF8Printable

func NonEmptyUTF8Printable(maxlength int, rnd *rand.Rand) string

NonEmptyUTF8Printable returns a random string of the length between 1 and maxlength comprised of printable UTF8 characters

func RandomRuneUTF8FromRanges

func RandomRuneUTF8FromRanges(tables []*unicode.RangeTable, rnd *rand.Rand) rune

RandomRuneUTF8FromRanges returns a random rune in the given RangeTable.

func RandomRuneUTF8Printable

func RandomRuneUTF8Printable(rnd *rand.Rand) rune

RandomRuneUTF8Printable returns a random rune of a printable range.

func ToRandomCase

func ToRandomCase(input string, rnd *rand.Rand) string

ToRandomCase returns randomly cased(uppercase, lowercase or RaNDomcASe) input string or the input string without any changes

func URL

func URL(schema string, rnd *rand.Rand) string

URL returns a random URL string with given schema, 1-4 random subdomains and 0-5 subdirectories

func UTF8FromRanges

func UTF8FromRanges(length int, rnd *rand.Rand, tables ...*unicode.RangeTable) string

UTF8FromRanges generates a random UTF8 string of a given character length that exists on the given RangeTables. For a list of valid RangeTables, see http://golang.org/pkg/unicode/#pkg-variables

func UTF8Printable

func UTF8Printable(length uint64, rnd *rand.Rand) string

UTF8Printable generates a random UTF8 string of a given character length consist of the printable UTF8 characters

Types

This section is empty.

Jump to

Keyboard shortcuts

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