core: Index | Files

package rand

import ""

Package rand provides various utitilies related to generating cryptographically secure random numbers and byte vectors.


Package Files

math.go rand_linux.go rand_reader.go


var (
    // Reader is a replacement for crypto/rand.Reader.
    Reader io.Reader

func Exp Uses

func Exp(r *rand.Rand, lambda float64) float64

Exp returns a random sample from the exponential distribution characterized by lambda (inverse of the mean).

func ExpQuantile Uses

func ExpQuantile(lambda, p float64) float64

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.

func NewMath Uses

func NewMath() *rand.Rand

NewMath returns a "cryptographically secure" math/rand.Rand.

func Poisson Uses

func Poisson(r *rand.Rand, lambda float64) int

Poisson returns a random sample from the poisson distribution characterized by lambda (mean).

Package rand imports 16 packages (graph) and is imported by 33 packages. Updated 2019-09-17. Refresh now. Tools for package owners.