Skip to content

Commit

Permalink
internal/token: New now returns tokens with length in [minSize, maxSize]
Browse files Browse the repository at this point in the history
  • Loading branch information
azazeal committed Mar 4, 2024
1 parent d54371a commit da32c8a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/token/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import (
"github.com/stretchr/testify/require"
)

// New returns a random token with length between minSize and maxSize.
// New returns a random token with length in the [minSize, maxSize] interval.
//
// If bucket is set, then the returned value will be valid to be used as a bucket.
func New(t *testing.T, minSize, maxSize int, bucket bool) (tok []byte) {
if minSize == maxSize {
tok = make([]byte, maxSize)
} else {
tok = make([]byte, minSize+mand.Intn(maxSize-minSize)) //nolint:gosec // not a sensitive op
tok = make([]byte, minSize+mand.Intn(1+maxSize-minSize)) //nolint:gosec // not a sensitive op
}

src := rand.Reader
Expand Down

0 comments on commit da32c8a

Please sign in to comment.