Documentation ¶
Index ¶
- Variables
- func AbsInt[T int | int64 | int32 | uint | uint32 | uint64](n T) T
- func AnyToFloat64(val any) (float64, error)
- func AnyToInt64(value any) (int64, 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(randomizer rng.Rand, l int64) (int64, error)
- func GenerateRandomInt64InLengthRange(randomizer rng.Rand, minValue, maxValue int64) (int64, error)
- func GenerateRandomInt64InValueRange(randomizer rng.Rand, minValue, maxValue int64) (int64, error)
- func GenerateRandomStringWithDefinedLength(randomizer rng.Rand, length int64) (string, error)
- func GenerateRandomStringWithInclusiveBounds(randomizer rng.Rand, 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](randomizer rng.Rand, arr []T) (T, error)
- func GetSeedOrDefault(seed *int64) (int64, error)
- func IsAllowedSpecialChar(r rune) bool
- func IsLastIntDigitZero[T int | int64 | int32 | uint | uint32 | uint64](n T) bool
- func IsValidChar(s string) bool
- func IsValidEmail(email string) bool
- func MinInt[T int | int64 | int32 | uint | uint32 | uint64](a, b T) T
- 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 AnyToInt64 ¶ added in v0.4.51
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 ¶
func GenerateRandomStringWithInclusiveBounds(randomizer rng.Rand, minValue, maxValue int64) (string, error)
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 GetSeedOrDefault ¶ added in v0.4.51
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 IsValidEmail ¶
func TrimStringIfExceeds ¶
func WithoutCharacters ¶
Types ¶
This section is empty.