github.com/CAFxX/fastrand@v0.1.0/seed.go (about) 1 package fastrand 2 3 import ( 4 "crypto/rand" 5 "encoding/binary" 6 ) 7 8 // Seed returns a random uint64 from crypto/rand. 9 func Seed() uint64 { 10 b := [8]byte{} 11 n, err := rand.Read(b[:]) 12 if n != 8 || err != nil { 13 panic("unable to read seed") 14 } 15 return binary.LittleEndian.Uint64(b[:]) 16 }