JS produces 20-bit random number to 0-9 as an example can also be a-Z a-z_javascript tips

Source: Internet
Author: User

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 The number of rows to be generated
var result= "";
for (Var i=0;i<20;i++) {///Generate 20 bits to make i<20
R=math.floor (Math.random () *16);//16 the number of data in the array, the purpose is to use this moment to mark the value in the arrays! 
Result+=data[r]//output 20 times random number at the same time, let RRR add 20 times, is 20 bit of random string. 
} 
document.write (result); 
document.write ("<br/>"); 
} }

Full HTML code:

  
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.