gen

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: BSL-1.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRand

func GetRand() *rand.Rand

GetRand returns a cryptographically secure random number source

func SliceStrings

func SliceStrings(lenSlice int) []string

SliceStrings generates a slice of random strings with the given length. gen.String generates the strings. The length of each string is increasing for each position. Index 0 has a string of length 1, index 100 has a string of length 101. Removed dividing length by 2 from the original code to improve performance.

func SliceStringsFixed

func SliceStringsFixed(lenSlice, lenString int) []string

SliceStringsFixed generates a slice of strings with the given length lenSlice. gen.String generates the strings. The length of each string is defined by the passed lenString. This makes it possible to generate a slice of letters: Example: SliceStringsFixed(5, 1) -> ["a", "c", "e", "g", "i"] or a slice of strings with the same length: Example: SliceStringsFixed(5, 3) -> ["gea", "brv", "pgd", "qwo", "cie"]

func String

func String(n int) string

String generates a random string of length n Source: https://stackoverflow.com/a/31832326/5516320

Types

This section is empty.

Jump to

Keyboard shortcuts

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