fs: update use of math/rand to modern practice
This commit is contained in:
parent
7aa066cff8
commit
208e49ce4b
3 changed files with 6 additions and 6 deletions
|
@ -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 a new issue