Documentation ¶
Overview ¶
Package rand provides various utitilies related to generating cryptographically secure random numbers and byte vectors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Reader is a replacement for crypto/rand.Reader. Reader io.Reader )
Functions ¶
func Exp ¶
Exp returns a random sample from the exponential distribution characterized by lambda (inverse of the mean).
func ExpQuantile ¶
ExpQuantile returns the value at which the the probability of a random value is less than or equal to the given probability for an exponential distribution characterized by lambda.
Types ¶
type DeterministicRandReader ¶
type DeterministicRandReader struct {
// contains filtered or unexported fields
}
DeterministicRandReader is a random Reader whose output is a chacha20 keystream.
func NewDeterministicRandReader ¶
func NewDeterministicRandReader(key []byte) (*DeterministicRandReader, error)
NewDeterministicRandReader returns a DeterministicRandReader initialized with key.
func (*DeterministicRandReader) Int63 ¶
func (r *DeterministicRandReader) Int63() int64
Int63 returns a random int64 with most significant bit set to 0.
func (*DeterministicRandReader) Perm ¶
func (r *DeterministicRandReader) Perm(n int) []int
Perm returns the shuffled slice of integers from 0 to n.
func (*DeterministicRandReader) Read ¶
func (r *DeterministicRandReader) Read(data []byte) (int, error)
Read writes the keystream into the passed byteslice and returns the number of bytes written.
func (*DeterministicRandReader) Seed ¶
func (r *DeterministicRandReader) Seed(seed int64)
Seed initializes the DeterministicRandReader with nonce.