4 cryptorand "crypto/rand"
6 mathrand2 "math/rand/v2"
15// NewPseudoRand returns a new PRNG seeded with random bytes from crypto/rand. Its
16// functions can be called concurrently.
17func NewPseudoRand() *rand {
19 cryptorand.Read(seed[:])
20 return &rand{rand: mathrand2.New(mathrand2.NewChaCha8(seed))}
23func (r *rand) Float64() float64 {
26 return r.rand.Float64()
29func (r *rand) IntN(n int) int {
35// CryptoRandInt returns a cryptographically random number.
36func CryptoRandInt() int64 {
38 cryptorand.Read(buf[:])
39 return int64(binary.LittleEndian.Uint64(buf[:]))