Generate N Random Hexadecimal Numbers | Maximum length of the random integer ; Function to generate N Hexadecimal integers ; Stores all the possible charcters in the Hexadecimal notation ; Loop to print N integers ; Randomly select length of the int in the range [ 1 , maxSize ] ; Print len charcters ; Print a randomly selected character ; Driver Code
const maxSize = 10 ; function randomHexInt ( N ) { let hexChar = [ ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' ] ; for ( let i = 0 ; i < N ; i ++ ) { let len = Math . random ( ) * ( maxSize - 1 ) + 1 ; for ( let j = 0 ; j < len ; j ++ ) { document . write ( hexChar [ Math . floor ( Math . random ( ) * ( 16 ) ) ] ) ; } document . write ( " " ) } } let N = 3 ; randomHexInt ( N ) ;