refactor: use math/rand only for parallel processor seeding
This commit is contained in:
@@ -2,7 +2,6 @@ package commands
|
||||
|
||||
import (
|
||||
"context"
|
||||
cryptoRand "crypto/rand"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"runtime"
|
||||
@@ -25,11 +24,6 @@ func NewParallelProcessor() *ParallelProcessor {
|
||||
maxWorkers := max(min(runtime.NumCPU(), 8), 2)
|
||||
|
||||
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])
|
||||
}
|
||||
|
||||
return &ParallelProcessor{
|
||||
maxWorkers: maxWorkers,
|
||||
|
||||
Reference in New Issue
Block a user