Example #1
0
// 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.
func SeedForTests() {
	seed := envutil.EnvOrDefaultInt64("COCKROACH_RANDOM_SEED", NewPseudoSeed())
	rand.Seed(seed)
	log.Printf("Random seed: %v", seed)
}
Example #2
0
// 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.
func SeedForTests() {
	seed := envutil.EnvOrDefaultInt64("random_seed", NewPseudoSeed())
	rand.Seed(seed)
	log.Printf("Random seed: %v", seed)
}