JS math.random random number, code to generate random integers within the specified range

<script type="text/javascript">
	
		function aaa()
		{
			var ran1 = Math.random();
			document.write(ran1);
			var min = 0;
			var max = 16777215;
			var random = Math.floor(Math.random()*(max-min)+min);
			//The background color of the web page, assign a value to the property of document.bgColor
			document.write('<br>'+random.toString(16));//.toString(16) converts decimal to hexadecimal string.
			document.bgColor = "#"+random.toString(16);
		}
	aaa();
    </script>


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325435422&siteId=291194637