Skip to content

Commit

Permalink
fix(epic) use PRNG
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Brian Tiger Chow <[email protected]>
  • Loading branch information
Brian Tiger Chow committed Dec 13, 2014
1 parent c00a7a2 commit 71d6e5c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions epictest/addcat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package epictest

import (
"bytes"
randcrypto "crypto/rand"
"fmt"
"io"
"os"
Expand All @@ -21,8 +20,11 @@ import (
util "github.com/jbenet/go-ipfs/util"
errors "github.com/jbenet/go-ipfs/util/debugerror"
delay "github.com/jbenet/go-ipfs/util/delay"
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-random"
)

const kSeed = 1

func Test100MBInstantaneous(t *testing.T) {
t.Log("a sanity check")

Expand Down Expand Up @@ -109,8 +111,7 @@ func AddCatBytes(conf Config) error {

adder.SetBlockstoreLatency(0) // disable blockstore latency during add operation
var data bytes.Buffer
// FIXME replace with a random data generator that reproduces data given a seed value
io.Copy(&data, &io.LimitedReader{R: randcrypto.Reader, N: conf.DataAmountBytes})
random.WritePseudoRandomBytes(conf.DataAmountBytes, &data, kSeed) // FIXME get a lazy reader
keyAdded, err := add(adder, bytes.NewReader(data.Bytes()))
if err != nil {
return err
Expand Down

0 comments on commit 71d6e5c

Please sign in to comment.