stacker.news/lib/rand.js
Bryan Mutai 984790ed5c
feat(Poll): add option to randomize poll choices (#2082)
* feat(Poll): add option to randomize poll choices

* improve

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
2025-04-15 17:19:14 -05:00

8 lines
180 B
JavaScript

export function randInRange (min, max) {
return Math.random() * (max - min) + min
}
export function shuffleArray (array) {
return [...array].sort(() => Math.random() - 0.5)
}