From b8eb45c9dfe6572b80adcdb7bd0dcf55786dcf3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Thu, 4 Sep 2025 11:18:39 +0200 Subject: [PATCH] tpl/collections: Require collections.D args to be ints Fixes #13952 Co-authored-by: Joe Mooring --- tpl/collections/collections.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tpl/collections/collections.go b/tpl/collections/collections.go index 1447a3fab..b678f0c1e 100644 --- a/tpl/collections/collections.go +++ b/tpl/collections/collections.go @@ -539,8 +539,8 @@ type dKey struct { // using J. S. Vitter's Method D for sequential random sampling, from Vitter, J.S. // - An Efficient Algorithm for Sequential Random Sampling - ACM Trans. Math. Software 11 (1985), 37-57. // See https://getkerf.wordpress.com/2016/03/30/the-best-algorithm-no-one-knows-about/ -func (ns *Namespace) D(seed, n, hi any) []int { - key := dKey{seed: cast.ToUint64(seed), n: cast.ToInt(n), hi: cast.ToInt(hi)} +func (ns *Namespace) D(seed, n, hi int) []int { + key := dKey{seed: cast.ToUint64(seed), n: n, hi: hi} if key.n <= 0 || key.hi <= 0 || key.n > key.hi { return nil }