Skip to content

Commit b8eb45c

Browse files
bepjmooring
andcommitted
tpl/collections: Require collections.D args to be ints
Fixes #13952 Co-authored-by: Joe Mooring <joe.mooring@veriphor.com>
1 parent 1d90aff commit b8eb45c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎tpl/collections/collections.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,8 +539,8 @@ type dKey struct {
539539
// using J. S. Vitter's Method D for sequential random sampling, from Vitter, J.S.
540540
// - An Efficient Algorithm for Sequential Random Sampling - ACM Trans. Math. Software 11 (1985), 37-57.
541541
// See https://getkerf.wordpress.com/2016/03/30/the-best-algorithm-no-one-knows-about/
542-
func (ns *Namespace) D(seed, n, hi any) []int {
543-
key := dKey{seed: cast.ToUint64(seed), n: cast.ToInt(n), hi: cast.ToInt(hi)}
542+
func (ns *Namespace) D(seed, n, hi int) []int {
543+
key := dKey{seed: cast.ToUint64(seed), n: n, hi: hi}
544544
if key.n <= 0 || key.hi <= 0 || key.n > key.hi {
545545
return nil
546546
}

0 commit comments

Comments
 (0)