Fix get_random for count != 4k, add randomReader()
This commit is contained in:
parent
3bf66d24fa
commit
93abaf204a
1 changed files with 7 additions and 7 deletions
|
@ -16,18 +16,18 @@ var benchArchiveDirectory = flag.String("test.benchdir", "", "benchmark archivin
|
||||||
func get_random(seed, count int) []byte {
|
func get_random(seed, count int) []byte {
|
||||||
buf := make([]byte, count)
|
buf := make([]byte, count)
|
||||||
|
|
||||||
rnd := rand.New(rand.NewSource(23))
|
rnd := rand.New(rand.NewSource(int64(seed)))
|
||||||
for i := 0; i < count; i += 4 {
|
for i := 0; i < count; i++ {
|
||||||
r := rnd.Uint32()
|
buf[i] = byte(rnd.Uint32())
|
||||||
buf[i] = byte(r)
|
|
||||||
buf[i+1] = byte(r >> 8)
|
|
||||||
buf[i+2] = byte(r >> 16)
|
|
||||||
buf[i+3] = byte(r >> 24)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func randomReader(seed, size int) *bytes.Reader {
|
||||||
|
return bytes.NewReader(get_random(seed, size))
|
||||||
|
}
|
||||||
|
|
||||||
const bufSize = chunker.MiB
|
const bufSize = chunker.MiB
|
||||||
|
|
||||||
func benchmarkChunkEncrypt(b testing.TB, rd interface {
|
func benchmarkChunkEncrypt(b testing.TB, rd interface {
|
||||||
|
|
Loading…
Reference in a new issue