mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 21:34:38 +03:00
switch to math/rand/v2 in most places
this allows removing some ugly instantiations of an rng based on the current time. Intn is now IntN for our concurrency-safe prng wrapper to match the randv2 api. v2 exists since go1.22, which we already require.
This commit is contained in:
8
junk.go
8
junk.go
@ -214,12 +214,12 @@ messages are shuffled, with optional random seed.`
|
||||
hamFiles := listDir(hamDir)
|
||||
spamFiles := listDir(spamDir)
|
||||
|
||||
var rand *mathrand.Rand
|
||||
var seed int64
|
||||
if a.seed {
|
||||
rand = mathrand.New(mathrand.NewSource(time.Now().UnixMilli()))
|
||||
} else {
|
||||
rand = mathrand.New(mathrand.NewSource(0))
|
||||
seed = time.Now().UnixMilli()
|
||||
}
|
||||
// Still at math/rand (v1 instead of v2) for potential comparison to earlier test results.
|
||||
rand := mathrand.New(mathrand.NewSource(seed))
|
||||
|
||||
shuffle := func(l []string) {
|
||||
count := len(l)
|
||||
|
Reference in New Issue
Block a user