export function getRandomInt ( min , max ) { return Math . floor ( Math . random ( ) * ( max - min ) + min ) ; } export function getRandomInts ( count , max ) { const nums = new Set < number > ( ) ; const adjustedCount = Math . min ( count , max ) ; while ( nums . size < adjustedCount ) { nums . add ( getRandomInt ( 0 , max ) ) ; } return nums ; } export function selectRandom < T > ( list ) { return list [ getRandomInt ( 0 , list . length ) ] ; } export function selectRandomN < T > ( list , n ) { const results = [ ] ; getRandomInts ( n , list . length ) . forEach ( i => results . push ( list [ i ] ) ) ; return results ; }