golang.org/x/tools@v0.21.0/cmd/bisect/rand.go (about)

     1  // Copyright 2023 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Starting in Go 1.20, the global rand is auto-seeded,
     6  // with a better value than the current Unix nanoseconds.
     7  // Only seed if we're using older versions of Go.
     8  
     9  //go:build !go1.20
    10  
    11  package main
    12  
    13  import (
    14  	"math/rand"
    15  	"time"
    16  )
    17  
    18  func init() {
    19  	rand.Seed(time.Now().UnixNano())
    20  }