Use JS to find random numbers, Random number formula: Math.random()*(max-min) min
Example, find 0-10 Find a random integer between 10-20; Find a random integer between 20 and 30; Find a random integer between 7 and 91
function geta(max,min){ Function var random =Math.random()*(max-min) min; // Find the formula for random numbers
random = Math.floor(random); // Round down (remove decimals directly)
Document.write (random "& lt; hr/& gt;"); // output results
}
geta(0,10);
geta(10,20);
geta(20,30);
geta(7,91);
Example, find 0-10 Find a random integer between 10-20; Find a random integer between 20 and 30; Find a random integer between 7 and 91
function geta(max,min){ Function var random =Math.random()*(max-min) min; // Find the formula for random numbers random = Math.floor(random); // Round down (remove decimals directly) Document.write (random "& lt; hr/& gt;"); // output results } geta(0,10); geta(10,20); geta(20,30); geta(7,91);Use JS to find random numbers,
Random number formula: Math.random()*(max-min) min
How to generate random numbers in html tags? -PHP Chinese website Q&A-How to generate random numbers in html tags? -PHP Chinese website Q&A
Let’s take a look and learn.
你这图片显示随机数,你能确保任何数字都能有个图片在服务器上面吗,所以你这个随机数应该是有个范围在,或者说,定义一个集合,里面放所有图片随机数,