export const weightedRandom = ( max , dice ) : number => { let num = 0 ; for ( let i = 0 ; i < dice ; i ++ ) { num += Math . random ( ) * ( max / dice ) ; } return num ; } ; export const sample = < T > ( arr ) : T => arr [ Math . floor ( Math . random ( ) * arr . length ) ] ; export const randomIntFrom = ( min , max ) => Math . floor ( Math . random ( ) * ( max - min + 1 ) + min ) ;