github.com/pachyderm/pachyderm@v1.13.4/src/server/pkg/testutil/random/random.go (about)

     1  package random
     2  
     3  import (
     4  	"fmt"
     5  	"math/rand"
     6  	"strconv"
     7  	"time"
     8  )
     9  
    10  // SeedRand seeds the rand package with a seed based on the time and returns
    11  // a string with the seed embedded in it.
    12  func SeedRand(customSeed ...int64) string {
    13  	seed := time.Now().UTC().UnixNano()
    14  	if len(customSeed) > 0 {
    15  		seed = customSeed[0]
    16  	}
    17  	rand.Seed(seed)
    18  	return fmt.Sprint("seed: ", strconv.FormatInt(seed, 10))
    19  }