package
25.1.0+incompatible
Repository: https://github.com/cockroachdb/cockroach.git
Documentation: pkg.go.dev

# Functions

FastInt63 returns a non-negative pseudo-random 63-bit integer as an int64.
FastUint32 returns a lock free uint32 value.
Same as NewPseudoRand, but the returned Rand is using thread safe underlying source.
NewLockedSource creates random source protected by mutex.
NewLockedTestRand is identical to NewTestRand but returned rand.Rand is using thread safe underlying source.
NewPseudoRand returns an instance of math/rand.Rand seeded from the environment variable COCKROACH_RANDOM_SEED.
NewPseudoSeed generates a seed from crypto/rand.
NewTestRand returns an instance of math/rand.Rand seeded from rng, which is seeded with the global seed.
NewTestRandWithSeed returns an instance of math/rand.Rand, similar to NewTestRand, but with the seed specified.
RandBytes returns a byte slice of the given length with random data.
RandDuration returns a random duration in [0, max).
RandInt63InRange returns a value in [min, max).
RandIntInRange returns a value in [min, max).
RandString generates a random string of the desired length from the input alphabet.
RandUint64n generates a 64-bit random number in [0, n) range.
ReadTestdataBytes reads random bytes, but then nudges them into printable ASCII, *reducing their randomness* to make them a little friendlier for humans using them as testdata.
SeedForTests seeds the random number generator and prints the seed value used.

# Constants

PrintableKeyAlphabet to use with random string generation to produce strings that doesn't need to be escaped when found as a part of a key and is generally human printable.