randutil

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bits

func Bits(b []byte)

func CBytes

func CBytes(n int) []byte

This only uses the OS's randomness

func CReader

func CReader() io.Reader

Returns a crand.Reader.

func CString

func CString(numDigits int) string

CRandHex returns a hex encoded string that's floor(numDigits/2) * 2 long.

Note: CRandHex(24) gives 96 bits of randomness that are usually strong enough for most purposes.

func Int

func Int(min int, max int) int

Int returns a random integer in range [min, max].

func Intn

func Intn(n int) int

func Ints

func Ints(from, to, size int) []int

Ints returns a random integer array with the specified from, to and size.

func Probability

func Probability(prob float64) bool

func String

func String(n int) string

String returns a random string ['a', 'z'] in the specified length

Types

This section is empty.

Jump to

Keyboard shortcuts

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