Compare commits

..

2 Commits

2 changed files with 0 additions and 12 deletions

View File

@@ -2,7 +2,6 @@ package commands
import ( import (
"context" "context"
cryptoRand "crypto/rand"
"fmt" "fmt"
"math/rand" "math/rand"
"runtime" "runtime"
@@ -25,11 +24,6 @@ func NewParallelProcessor() *ParallelProcessor {
maxWorkers := max(min(runtime.NumCPU(), 8), 2) maxWorkers := max(min(runtime.NumCPU(), 8), 2)
seed := time.Now().UnixNano() 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{ return &ParallelProcessor{
maxWorkers: maxWorkers, maxWorkers: maxWorkers,

View File

@@ -1,7 +1,6 @@
package commands package commands
import ( import (
cryptoRand "crypto/rand"
"errors" "errors"
"flag" "flag"
"fmt" "fmt"
@@ -26,11 +25,6 @@ var (
func initSeedRand() { func initSeedRand() {
seedRandOnce.Do(func() { seedRandOnce.Do(func() {
seed := time.Now().UnixNano() 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)) seedRandSource = rand.New(rand.NewSource(seed))
}) })
} }