cockroach: github.com/abhinavdahiya/cockroach/util/randutil Index | Files

package randutil

import "github.com/abhinavdahiya/cockroach/util/randutil"

Index

Package Files

rand.go

func NewPseudoRand Uses

func NewPseudoRand() (*rand.Rand, int64)

NewPseudoRand returns an instance of math/rand.Rand seeded from crypto/rand and its seed so we can easily and cheaply generate unique streams of numbers. The created object is not safe for concurrent access.

func NewPseudoSeed Uses

func NewPseudoSeed() int64

NewPseudoSeed generates a seed from crypto/rand.

func RandBytes Uses

func RandBytes(r *rand.Rand, size int) []byte

RandBytes returns a byte slice of the given length with random data.

func RandIntInRange Uses

func RandIntInRange(r *rand.Rand, min, max int) int

RandIntInRange returns a value in [min, max)

func SeedForTests Uses

func SeedForTests()

SeedForTests seeds the random number generator and prints the seed value used. This value can be specified via an environment variable COCKROACH_RANDOM_SEED=x to reuse the same value later. This function should be called from TestMain; individual tests should not touch the seed of the global random number generator.

Package randutil imports 6 packages (graph). Updated 2017-03-13. Refresh now. Tools for package owners. This is a dead-end fork (no commits since the fork).