-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfinal.txt
36 lines (23 loc) · 805 Bytes
/
final.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!DOCTYPE html>
<html>
<body>
<h1>Rogue Predictions By Rahul Golam.</h1>
<p>Loto number generator:</p>
<p id="demo"></p>
<script>
function generateRan() {
var randNum =[];//initialise array randNum//
for ( i = 0; i < 6; i++ ) {// initialise (i=0) , conditions for loop, increment (i) each time the code block in the loop has been executed.//
var temp = Math.floor(Math.random() * 40)+1;// generating random number from 1-40//
if(randNum.indexOf(temp) == -1){//searches array for temp and returns its position,returns -1 if not found//
randNum.push(temp);//The new temp will be added at the end of the array//
}
else
i--;
}
document.write(randNum.sort((a,b)=>a-b) + "\n" );// output numbers generated//
}
generateRan();
</script>
</body>
</html>