Skip to content

Commit

Permalink
Use io.ReadFull
Browse files Browse the repository at this point in the history
  • Loading branch information
gagliardetto committed Aug 28, 2022
1 parent 2b26380 commit ff80879
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions interface_bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
package bin

import (
"math/rand"
"crypto/rand"
"io"
mrand "math/rand"
"testing"
)

Expand Down Expand Up @@ -107,19 +109,18 @@ type benchSubset2 struct {
func makeUint64List(itemCount int) (out []int64) {
out = make([]int64, itemCount)
for i := 0; i < itemCount; i++ {
out[i] = rand.Int63()
// get random int64:
out[i] = mrand.Int63()
}

return
}

func makeStringList(itemCount int) (out []string) {
out = make([]string, itemCount)
for i := 0; i < itemCount; i++ {
data := make([]byte, i>>1)
rand.Read(data)
io.ReadFull(rand.Reader, data)
out[i] = string(data)
}

return
}

0 comments on commit ff80879

Please sign in to comment.