From abc56151bb98f4adbfc4938c556c375a6c3e9407 Mon Sep 17 00:00:00 2001 From: Harmen Date: Wed, 13 Dec 2023 12:09:29 +0100 Subject: [PATCH] cleanup last commit --- cmd_hash.go | 3 +-- miniredis.go | 7 ------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/cmd_hash.go b/cmd_hash.go index 1a82938..2c45630 100644 --- a/cmd_hash.go +++ b/cmd_hash.go @@ -4,7 +4,6 @@ package miniredis import ( "math/big" - "math/rand" "strconv" "strings" @@ -750,7 +749,7 @@ func (m *Miniredis) cmdHrandfield(c *server.Peer, cmd string, args []string) { // if count is negative there can be duplicates, but length will match if len(members) > 0 { for len(members) < -opts.count { - members = append(members, members[rand.Intn(len(members))]) + members = append(members, members[m.randIntn(len(members))]) } } } diff --git a/miniredis.go b/miniredis.go index d2ea270..15dd08f 100644 --- a/miniredis.go +++ b/miniredis.go @@ -634,13 +634,6 @@ func (m *Miniredis) randIntn(n int) int { return m.rand.Intn(n) } -func (m *Miniredis) randPerm(n int) []int { - if m.rand == nil { - return rand.Perm(n) - } - return m.rand.Perm(n) -} - // shuffle shuffles a list of strings. Kinda. func (m *Miniredis) shuffle(l []string) { for range l {