mirror of
https://github.com/gohugoio/hugo.git
synced 2025-09-17 08:37:14 -04:00
tpl/collections: Require collections.D args to be ints
Fixes #13952 Co-authored-by: Joe Mooring <joe.mooring@veriphor.com>
This commit is contained in:
parent
1d90afff1b
commit
b8eb45c9df
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user