rand

package
v2.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2018 License: MIT Imports: 3 Imported by: 2

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

This section is empty.

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) Init

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

Init resets the PRNG with the provided seed so as to recover it to a deterministic state

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() []byte

Seed exports the seed for next generation

Jump to

Keyboard shortcuts

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