Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateRandomBytes(n int) ([]byte, error)
- func GenerateRandomString(n int) (string, error)
- func GenerateRandomStringURLSafe(n int) (string, error)
- func GetCmdlineArg(long string, short string) string
- func GetCmdlineBool(long string, short string) bool
- func Lotto(cnt int, out int) []int
- func Shuffle(cnt int) []int
- func Shuffle0(s Interface)
- func Shuffle1(l []int, seed int64)
- type CryptoSrc
- type Interface
Constants ¶
View Source
const Max_Bytes = 20 << 20 // 20MB
View Source
const SizeLimit = 20 * 1024 * 1024 // x MB
Variables ¶
View Source
var ( ColorReset = "\033[0m" ColorRed = "\033[31m" ColorGreen = "\033[32m" ColorYellow = "\033[33m" ColorBlue = "\033[34m" ColorPurple = "\033[35m" ColorCyan = "\033[36m" ColorWhite = "\033[37m" )
Functions ¶
func GenerateRandomBytes ¶
GenerateRandomBytes returns securely generated random bytes
func GenerateRandomString ¶
GenerateRandomString returns a securely generated random string
func GenerateRandomStringURLSafe ¶
returns a URL-safe, base64 encoded securely generated random string
func GetCmdlineArg ¶
func GetCmdlineBool ¶
func Shuffle0 ¶
func Shuffle0(s Interface)
Shuffle shuffles the data using the following algorithm:
To shuffle an array a of n elements (indices 0..n-1): for i from n − 1 downto 1 do j ← random integer with 0 ≤ j ≤ i exchange a[j] and a[i]
Types ¶
type Interface ¶
type Interface interface { // Len is the number of elements in the collection. Len() int // Swap swaps the elements with indexes i and j. Swap(i, j int) }
----- Fisher–Yates_Shuffle https://github.com/carlmjohnson/go-utils Type Interface is similar to a sort.Interface, but there's no Less method
Click to show internal directories.
Click to hide internal directories.