rand

package
v0.0.0-...-835eb37 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PRNGFactory

type PRNGFactory func(seed []byte) (RNG, error)

PRNGFactory is function, which creates RNG from seed.

type RNG

type RNG io.Reader

RNG is extension for any io.Reader, which is RNG. USE WITH CAUTION, IN ORDER NOT TO WRAP INVALID READER AS RNG!!!

func DefaultRNG

func DefaultRNG() RNG

DefaultRNG returns default RNG. It's used when it's required and not provided in options.

func FastRNG

func FastRNG(seed int64) RNG

FastRNG creates NewSource from math/rand form golang STL. This RNG IS NOT cryptographically secure and SHOULD NOT be used for crypto.

func GetRNG

func GetRNG(options interface{}) (rng RNG)

GetRNG returns RNG from options or DefaultRNG.

func NewChaCha20RNG

func NewChaCha20RNG(seed []byte) (res RNG, err error)

NewChaCha20RNG creates ChaCha20 based RNG from specified seed. Seed has to be 32 bytes long. It can be extended with hash function if needed.

func ZeroRNG

func ZeroRNG() RNG

ZeroRNG is fake RNG which yields zeros only. IT'S HACK!!! DO NOT USE FOR ANY LEGITIMATE REASON!!!

type RNGOptions

type RNGOptions interface {
	GetRNG() RNG
}

RNGOptions is kind of options, which provides custom RNG.

Jump to

Keyboard shortcuts

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