generate

package
v0.0.0-...-65e2f22 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandomBytes

func RandomBytes(src rand.Source, n int) []byte

RandomBytes returns a generated bytes with the provided length.

Solution based on SO thread: http://stackoverflow.com/a/31832326/1590256

func RandomString

func RandomString(n int) string

RandomString returns a genrated string with the provided length.

func SecureToken

func SecureToken(n int) (string, error)

SecureToken returns a securely generated random string.

It will error if the system's secure random number generator fails.

Types

type RandPercentageFunc

type RandPercentageFunc func() int

RandPercentageFunc is the integer returned by RandomInt() which represents the rollout percentage

func RandPercentage

func RandPercentage(r *rand.Rand) RandPercentageFunc

RandPercentage returns a RandPercentage func that generates int in the range [min, max]

Jump to

Keyboard shortcuts

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