refactor: use math/rand only for seed command initialization

This commit is contained in:
2026-01-07 11:43:55 +01:00
parent c3d0d16e44
commit ac2dfdde70

View File

@@ -1,7 +1,6 @@
package commands
import (
cryptoRand "crypto/rand"
"errors"
"flag"
"fmt"
@@ -26,11 +25,6 @@ var (
func initSeedRand() {
seedRandOnce.Do(func() {
seed := time.Now().UnixNano()
seedBytes := make([]byte, 8)
if _, err := cryptoRand.Read(seedBytes); err == nil {
seed = int64(seedBytes[0])<<56 | int64(seedBytes[1])<<48 | int64(seedBytes[2])<<40 | int64(seedBytes[3])<<32 |
int64(seedBytes[4])<<24 | int64(seedBytes[5])<<16 | int64(seedBytes[6])<<8 | int64(seedBytes[7])
}
seedRandSource = rand.New(rand.NewSource(seed))
})
}