Random Number gererator within a range of 20 to 100

Random Number gererator within a range of 20 to 100
0

#1
<!DOCTYPE html>
<html>
<head><meta charset="utf-8">
<title>Random Number Generator</title>
</head>
<body>

	<p>Generate Random number</p>
	<input type="submit" name="Click here" onlick="myRandomNumber(20,100)">
	<p id ="demo"></p>

 <script>

let myRandomNumber = function(start, range){

	let random = document.selectElementById('demo').innerHTML = Math.floor((Math.random()*range)+ start);
		 	

		while( random > range) {                   

			let random = Math.floor((Math.random()*range)+ start);
			}          
		
	}

</script>

	</body>
</html>

#2

Hi

You have a typo, onlick should be onclick.

If you change that first, you will start getting some error messages in the console which might help you debug the rest of your code.

Hope that helps :slight_smile: