random

package
v0.0.0-...-6719cd2 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package random helps seed the math/rand pseudo-random number generator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SecureInt64

func SecureInt64() int64

SecureInt64 returns 64 bits of randomness from crypto/rand. It panics if crypto/rand returns an error. This is useful for passing into math/rand.

func SeedMath

func SeedMath()

SeedMath seeds the global math/rand pseudo-random number generator with a crypto/rand input. It panics if crypto/rand returns an error.

This should be called before using math/rand, which is otherwise seeded with the value 1. It's safe to call this multiple times, and doing so should produce no observable effects. However, it should not be called often for performance reasons.

Note: this does not make the math/rand output secure for cryptographic purposes, but it does make the math/rand output more useful for things like load balancing and randomized algorithms.

Types

This section is empty.

Jump to

Keyboard shortcuts

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