Files
ClassContent/历届学生/font-end-nine/项目练习/学生项目/张婷/作业/随机数.html
2024-09-27 02:06:13 +08:00

43 lines
1.4 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
// 1——var random = Math.random() -------------------------------- [0,1)
// 2——Math.random() * 10 --------------------------------------------[0,10)
// 3——(Math.random() * 10) +1 ---------------------------------------[1, 10)
// 以下函数返回 min(包含)~ max(不包含)之间的数字:
// 4——(Math.random() * (max-min)) + min -----------------------[min, max)
// 以下函数返回 min(包含)~ max(包含)之间的数字:
// 5——(Math.random() * (max-min+1)) + min ---------------- [min,max]
var totalWaterPipeHeight = this.innerHeight - 112 - this.WaterPipeClearance;
// 只限制最大高度,但是还是会出现上面自己压缩自己的情况
//方法一
//var TopWaterPipeHeight = Math.random() * (totalWaterPipeHeight*2/3);
//上水管最大最小高度都限制
//方法二
//var TopWaterPipeHeight = Math.random() * ( (totalWaterPipeHeight*2/3) - (totalWaterPipeHeight*1/3) ) + (totalWaterPipeHeight*1/3))
var BottomWaterPipeHeight = totalWaterPipeHeight - TopWaterPipeHeight;
</script>
</html>