randomex

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: MIT Imports: 2 Imported by: 0

README

randomex

randomex implements a couple of random string generation functions used mostly for testing and is a repackage of the only useful part of a package I did back when learning golang, now with added module support.

Additional functionality might be added later.

installation

go get "github.com/vedranvuk/randomex"

Documentation

Index

Constants

View Source
const (

	// PasswordSet is a common special character set used in passwords.
	// < and > may cause issues on some systems.
	PasswordSet = " !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
)

Variables

This section is empty.

Functions

func Rand

func Rand(length int) string

Rand is a shorthand for Random which includes all characters.

func String added in v0.2.0

func String(lo, up, nums, special bool, length int) string

String returns a random string of "length". If "lo" includes lowercase letters. If "up" includes uppercase letters. If "num" includes numbers. If "special" includes password special characters.

func StringLower added in v0.2.0

func StringLower() string

StringLower returns a string containing a random lowercase letter.

func StringLowers added in v0.2.0

func StringLowers(length int) string

StringLowers returns a string of random lowercase letters of "length".

func StringNum added in v0.2.0

func StringNum() string

StringNum returns a string containing a single digit random number.

func StringNums added in v0.2.0

func StringNums(length int) string

StringNums returns a string of random numbers of "length".

func StringOf added in v0.2.0

func StringOf(length int, funcs ...func() string) string

StringOf takes any number of functins returning a string and calls them randomly until resulting string is of specified length.

func StringSet added in v0.2.0

func StringSet(set string) string

StringSet returns a single random character from the specified set.

func StringSpecial added in v0.2.0

func StringSpecial() string

StringSpecial returns a string containing a random password special character.

func StringSpecials added in v0.2.0

func StringSpecials(length int) string

StringSpecials returns a string of random special characters of "length".

func StringUpper added in v0.2.0

func StringUpper() string

StringUpper returns a string containing a random uppercase letter.

func StringUppers added in v0.2.0

func StringUppers(length int) string

StringUppers returns a string of random uppercase letters of "length".

Types

This section is empty.

Jump to

Keyboard shortcuts

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