diff options
author | Felix Lange <fjl@twurst.com> | 2017-03-23 02:48:51 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2017-03-23 03:49:15 +0800 |
commit | f1534f5797664856218c8347366488f37f1e7924 (patch) | |
tree | 6a5d4a7dcfd72489bd4f7df70f5188a636947c24 /trie | |
parent | 9a2720fb35c9802c6dd61f9a49c48620b2ba2ecb (diff) | |
download | dexon-f1534f5797664856218c8347366488f37f1e7924.tar.gz dexon-f1534f5797664856218c8347366488f37f1e7924.tar.zst dexon-f1534f5797664856218c8347366488f37f1e7924.zip |
trie, whisper/whisperv5: use math/rand Read function
Diffstat (limited to 'trie')
-rw-r--r-- | trie/trie_test.go | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/trie/trie_test.go b/trie/trie_test.go index 60307dba8..01ae3a4e7 100644 --- a/trie/trie_test.go +++ b/trie/trie_test.go @@ -377,7 +377,7 @@ func (randTest) Generate(r *rand.Rand, size int) reflect.Value { if len(allKeys) < 2 || r.Intn(100) < 10 { // new key key := make([]byte, r.Intn(50)) - randRead(r, key) + r.Read(key) allKeys = append(allKeys, key) return key } @@ -401,22 +401,6 @@ func (randTest) Generate(r *rand.Rand, size int) reflect.Value { return reflect.ValueOf(steps) } -// rand.Rand provides a Read method in Go 1.7 and later, but -// we can't use it yet. -func randRead(r *rand.Rand, b []byte) { - pos := 0 - val := 0 - for n := 0; n < len(b); n++ { - if pos == 0 { - val = r.Int() - pos = 7 - } - b[n] = byte(val) - val >>= 8 - pos-- - } -} - func runRandTest(rt randTest) bool { db, _ := ethdb.NewMemDatabase() tr, _ := New(common.Hash{}, db) |