Documentation
¶
Index ¶
- Constants
- func Int() int
- func Int64() int64
- func NumberInRange(min, max int64) (int64, error)
- func Pick[T any](slice []T) (T, error)
- func SecureNumber() (int64, error)
- func Shuffle[T any](slice []T) error
- func String() (string, error)
- func StringWithCharset(length int, charset string) (string, error)
- func StringWithLength(length int) (string, error)
Constants ¶
View Source
const ( // DefaultCharset defines the default characters DefaultCharset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" // DefaultLength defines the default length for random string DefaultLength = 10 )
Variables ¶
This section is empty.
Functions ¶
func NumberInRange ¶
NumberInRange generates a pseudo-random number between min and max
func SecureNumber ¶
SecureNumber returns a cryptographically secure random number. Note: This function is significantly slower than Int() and Int64() due to the use of crypto/rand.
func StringWithCharset ¶
StringWithCharset generates a random string with the specified length and character set
func StringWithLength ¶
StringWithLength generates a random string of the specified length using the default charset
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.