lib/rand: Various fixes (#6474)

This commit is contained in:
greatroar
2020-03-30 23:26:28 +02:00
committed by GitHub
parent d7a257b391
commit c930b2e9e2
3 changed files with 13 additions and 48 deletions
-17
View File
@@ -8,23 +8,6 @@ package rand
import "testing"
func TestSeedFromBytes(t *testing.T) {
// should always return the same seed for the same bytes
tcs := []struct {
bs []byte
v int64
}{
{[]byte("hello world"), -3639725434188061933},
{[]byte("hello worlx"), -2539100776074091088},
}
for _, tc := range tcs {
if v := SeedFromBytes(tc.bs); v != tc.v {
t.Errorf("Unexpected seed value %d != %d", v, tc.v)
}
}
}
func TestRandomString(t *testing.T) {
for _, l := range []int{0, 1, 2, 3, 4, 8, 42} {
s := String(l)