Files
LearnGO/go/pkg/mod/github.com/cilium/ebpf@v0.11.0/internal/testutils/seed.go
T
2024-09-19 21:38:24 -04:00

22 lines
323 B
Go

package testutils
import (
"fmt"
"math/rand"
"sync"
"time"
)
var randSeed struct {
value int64
once sync.Once
}
func Rand() *rand.Rand {
randSeed.once.Do(func() {
randSeed.value = time.Now().UnixMicro()
fmt.Printf("Random seed is %d\n", randSeed.value)
})
return rand.New(rand.NewSource(randSeed.value))
}