rand

package
v0.0.0-...-f05ec83 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2017 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Reader io.Reader

Reader is a globally accessible PRNG (pseudo random number generator) instance

Functions

func RandSeed

func RandSeed() ([]byte, error)

RandSeed generates a random seed of predefined bytes

Types

type Rand

type Rand struct {
	// contains filtered or unexported fields
}

Rand implements a PRNG based on a sha3.ShakeHash

every read from which will update the internal seed as
seed := hash(seed)

func New

func New(seed []byte) *Rand

New makes PRNG instance based on the given seed

func (*Rand) ExportSeed

func (rng *Rand) ExportSeed() []byte

ExportSeed exports the seed for next generation

func (*Rand) Read

func (rng *Rand) Read(p []byte) (int, error)

Read reads out len(p) random bytes

and update the underlying state seed

func (*Rand) Seed

func (rng *Rand) Seed(seed []byte)

Seed uses provided seed to initialize the generator to a deterministic state

Jump to

Keyboard shortcuts

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