JS code:
function s20(){ var data=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"]; for(var j=0;j<500;j++){ //500 is the number of rows to be generated var result="";for(var i=0;i<20;i++){ // Generate 20 bits to make i<20r=Math.floor(Math.random()*16); //16 is the number of data in the array, the purpose is to use this current index to get the value in the array data! result+=data[r]; //While outputting 20 random numbers, add rrr 20 times, it is a 20-bit random string. } document.write(result); document.write("<br/>"); } }Complete html code:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <script type="text/javascript"> function s20(){ var data=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"]; for(var j=0;j<500;j++){ var result=""; for(var i=0;i<20;i++){ r=Math.floor(Math.random()*16);result+=data[r]; } document.write(result); document.write("<br/>"); } } </script> </head> <body> <input type="button" onclick="s20()" value="generate random number"> </body> </html>