rand

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2019 License: MPL-2.0 Imports: 8 Imported by: 7

Documentation

Overview

Package rand implements functions similar to math/rand in the standard library, but on top of a secure random number generator.

Index

Constants

This section is empty.

Variables

Reader is the standard crypto/rand.Reader, re-exported for convenience

Functions

func Int63

func Int63() int64

Int63 returns a strongly random int63

func Int64

func Int64() int64

Int64 returns a strongly random int64

func Intn

func Intn(n int) int

Intn returns, as an int, a non-negative strongly random number in [0,n). It panics if n <= 0.

func SeedFromBytes

func SeedFromBytes(bs []byte) int64

SeedFromBytes calculates a weak 64 bit hash from the given byte slice, suitable for use a predictable random seed.

func Shuffle added in v1.2.0

func Shuffle(slice interface{})

Shuffle the order of elements

func String

func String(l int) string

String returns a strongly random string of characters (taken from randomCharset) of the specified length. The returned string contains ~5.8 bits of entropy per character, due to the character set used.

Types

This section is empty.

Jump to

Keyboard shortcuts

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