randomizer

package
v1.10.33 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2022 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// Alphabets gets the a to z and A to Z
	Alphabets = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
	// Digits gets 0 to 9
	Digits = "0123456789"
	// AlphabetNumerics gets Alphabets and Digits
	AlphabetNumerics = Alphabets + Digits
	// Symbols gets the ascii symbols
	Symbols = "~!@#$%^&*()-_+={}[]\\|<,>.?/\"';:`"
	// ASCII gets the ascii characters
	ASCII = AlphabetNumerics + Symbols
)

var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")

Variables

This section is empty.

Functions

This section is empty.

Types

type HiresRandomizer

type HiresRandomizer interface {
	HiresNext() uint64
	HiresNextIn(max uint64) uint64
	HiresNextInRange(min, max uint64) uint64
}

HiresRandomizer enables high resolution randomizer

type Randomizer

type Randomizer interface {
	Next() int
	NextIn(max int) int
	NextInRange(min, max int) int
	AsHires() HiresRandomizer
	AsStrings() StringsRandomizer
}

Randomizer enables normal resolution randomizer

func New

func New() Randomizer

New return a tool for randomizer

type StringsRandomizer added in v1.7.33

type StringsRandomizer interface {
	// NextStringSimple returns a random string with specified length 'n', just in A..Z
	NextStringSimple(n int) string
	// NextString returns a random string with specified length 'n'
	NextString(n int) string

	NextStringByCharset(n int, charset []rune) string

	NextStringWithVariantLength() string
	NextStringWithVariantLengthRange(min, max int) string

	NextStringWithVariantLengthByCharset(min, max int, charset []rune) string
}

StringsRandomizer interface

Jump to

Keyboard shortcuts

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