mirror of
https://github.com/aykhans/sarin.git
synced 2026-02-28 06:49:13 +00:00
15 lines
401 B
Go
15 lines
401 B
Go
package sarin
|
|
|
|
import (
|
|
"math/rand/v2"
|
|
"time"
|
|
)
|
|
|
|
func NewDefaultRandSource() rand.Source {
|
|
now := time.Now().UnixNano()
|
|
return rand.NewPCG(
|
|
uint64(now), //nolint:gosec // G115: Safe conversion; UnixNano timestamp used as random seed, bit pattern is intentional
|
|
uint64(now>>32), //nolint:gosec // G115: Safe conversion; right-shifted timestamp for seed entropy, overflow is acceptable
|
|
)
|
|
}
|