随机数封装
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>随机数封装</title> </head> <body> <script type="text/javascript">
function RandomNumBoth(Min, Max) {
var Range = Max - Min;
var Rand = Math.random();
var num = Min + Math.round(Rand * Range);
return num;
}
var sj = RandomNumBoth(50,100); alert(sj); </script> </body> </html>