mirror of
https://github.com/rclone/rclone.git
synced 2024-11-07 09:04:52 +01:00
fs: update use of math/rand to modern practice
This commit is contained in:
parent
7aa066cff8
commit
208e49ce4b
@ -1,10 +1,10 @@
|
||||
package quickxorhash
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"hash"
|
||||
"math/rand"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
@ -171,7 +171,9 @@ var _ hash.Hash = (*quickXorHash)(nil)
|
||||
func BenchmarkQuickXorHash(b *testing.B) {
|
||||
b.SetBytes(1 << 20)
|
||||
buf := make([]byte, 1<<20)
|
||||
rand.Read(buf)
|
||||
n, err := rand.Read(buf)
|
||||
require.NoError(b, err)
|
||||
require.Equal(b, len(buf), n)
|
||||
h := New()
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
|
@ -10,7 +10,6 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"math/rand"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
@ -52,8 +51,7 @@ var (
|
||||
|
||||
// Seed the random number generator
|
||||
func init() {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
|
||||
_ = random.Seed()
|
||||
}
|
||||
|
||||
// Initialise rclone for testing
|
||||
|
@ -31,7 +31,7 @@ var (
|
||||
|
||||
// Seed the random number generator
|
||||
func init() {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
_ = random.Seed()
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user