const CHARS = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$' ; param number param fixed returns { number } function round ( number , fixed ) { const t = Math . pow ( 10 , fixed ) ; return Math . round ( number * t ) / t ; } param min param max param fixed returns { * } export function randomFloat ( min , max , fixed = 0 ) { if ( min > max ) { min = min ^ max ; max = min ^ max ; min = min ^ max ; } return round ( Math . random ( ) * ( max - min ) + min , fixed ) ; } returns { boolean } export function randomBool ( ) { return ! ! randomFloat ( 0 , 1 ) ; } returns { * } export function randomChar ( ) { return CHARS [ randomFloat ( 0 , CHARS . length - 1 ) ] ; } param len returns { string } export function randomString ( len ) { if ( len < 0 ) len = 0 ; return new Array ( len ) . fill ( 0 ) . map ( ( ) => randomChar ( ) ) . join ( '' ) ; }