Documentation ¶
Index ¶
- Variables
- func AbsInt[T int | int64 | int32 | uint | uint32 | uint64](n T) T
- func AnyToFloat64(val any) (float64, error)
- func Ceil[T int | int64 | int32 | uint | uint32 | uint64 | float32 | float64](n, ceiling T) T
- func ClampInts[T int | int32 | int64](input []T, minValue, maxValue *T) []T
- func FindClosestPair(sortedSlice1, sortedSlice2 []int64, maxValue int64) (leftidx, rightidx int64)
- func Floor[T int | int64 | int32 | uint | uint32 | uint64](n, floor T) T
- func GenerateCryptoSeed() (int64, error)
- func GenerateRandomFloat64WithInclusiveBounds(randomizer rng.Rand, minValue, maxValue float64) (float64, error)
- func GenerateRandomInt64FixedLength(l int64) (int64, error)
- func GenerateRandomInt64InLengthRange(minValue, maxValue int64) (int64, error)
- func GenerateRandomInt64InValueRange(minValue, maxValue int64) (int64, error)
- func GenerateRandomStringWithDefinedLength(length int64) (string, error)
- func GenerateRandomStringWithInclusiveBounds(minValue, maxValue int64) (string, error)
- func GenerateStringFromCorpus(randomizer rng.Rand, values []string, lengthMap map[int64][2]int, ...) (string, error)
- func GetInt64Length(i int64) int64
- func GetRandomCharacterString(randomizer rng.Rand, size int64) string
- func GetRandomValueFromSlice[T any](arr []T) (T, error)
- func GetSmallerOrEqualNumbers(nums []int64, val int64) []int64
- func IsAllowedSpecialChar(r rune) bool
- func IsLastIntDigitZero[T int | int64 | int32 | uint | uint32 | uint64](n T) bool
- func IsNegativeInt[T int | int64 | int32 | uint | uint32 | uint64](val T) bool
- func IsValidChar(s string) bool
- func IsValidDomain(domain string) bool
- func IsValidEmail(email string) bool
- func IsValidUsername(username string) bool
- func MaxInt[T int | int64 | int32 | uint | uint32 | uint64](a, b T) T
- func MinInt[T int | int64 | int32 | uint | uint32 | uint64](a, b T) T
- func SetToSlice[T rune | string](input map[T]struct{}) []T
- func SliceString(s string, l int) string
- func StringInSlice(str string, list []string) bool
- func ToSet[T string | int64](input []T) map[T]struct{}
- func TrimStringIfExceeds(s string, maxLength int64) string
- func WithoutCharacters(input string, invalidChars []rune) string
Constants ¶
This section is empty.
Variables ¶
var SpecialChars []rune
var SpecialCharsSet = map[rune]struct{}{
'!': {}, '@': {}, '#': {}, '$': {}, '%': {}, '^': {}, '&': {}, '*': {}, '(': {}, ')': {},
'-': {}, '+': {}, '=': {}, '_': {}, '[': {}, ']': {}, '{': {}, '}': {}, '|': {}, '\\': {},
' ': {}, ';': {}, '"': {}, '<': {}, '>': {}, ',': {}, '.': {}, '/': {}, '?': {},
}
Functions ¶
func AnyToFloat64 ¶
func FindClosestPair ¶
Given two sorted slices and a max value, returns the index from each slice that when summing their values, will be equal or as close to the maxValue as possible. There could be multiple combinations, but this algorithm attempts to find the closest pair, which finds the highest value in each slice that satisfies the maxValue constraint
func GenerateCryptoSeed ¶
func GenerateRandomFloat64WithInclusiveBounds ¶
func GenerateRandomFloat64WithInclusiveBounds(randomizer rng.Rand, minValue, maxValue float64) (float64, error)
Generates a random float64 in the range of the min and max float64 values
func GenerateRandomInt64FixedLength ¶
Generates a random int64 of length l. For example, given a length of 4, possible values will always have a length of 4 digits.
func GenerateRandomInt64InLengthRange ¶
Generates a random int64 with length in the inclusive range of [min, max]. For example, given a length range of [4, 7], possible values will have a length ranging from 4 -> 7 digits.
func GenerateRandomInt64InValueRange ¶
Generates a random int64 in the inclusive range of [min, max]. For example, given a range of [40, 50], possible values range from 40 -> 50, inclusive.
func GenerateRandomStringWithDefinedLength ¶
Generate a random alphanumeric string of length l
func GenerateRandomStringWithInclusiveBounds ¶
Generate a random alphanumeric string within the interval [min, max]
func GenerateStringFromCorpus ¶
func GenerateStringFromCorpus( randomizer rng.Rand, values []string, lengthMap map[int64][2]int, mapKeys []int64, minLength *int64, maxLength int64, exclusions []string, ) (string, error)
Generates a random string from the values corpus The lengthMap and mapKeys must be derivative of values. See the pre-generated values in the data-sets folder Eventually this will be abstracted into a Corpus struct for better readability. The expectation is the values, lengthMap, and mapKeys are all in their optimal, sorted form.
func GetRandomValueFromSlice ¶
returns a random index from a one-dimensional slice
func IsAllowedSpecialChar ¶
func IsLastIntDigitZero ¶
func IsValidChar ¶
use MaxASCII to ensure that the unicode value is only within the ASCII block which only contains latin numbers, letters and characters.
func IsValidDomain ¶
func IsValidEmail ¶
func IsValidUsername ¶
func SetToSlice ¶
func SliceString ¶
substrings a string using rune length to account for multi-byte characters
func StringInSlice ¶
stringInSlice checks if a string is present in a slice of strings. It returns true if the string is found, and false otherwise.
func TrimStringIfExceeds ¶
func WithoutCharacters ¶
Types ¶
This section is empty.