<html>
<body>
<script type="text/javascript">
var r=Math.random();
if (r>0.5)
{
document.write("<a href='http://www.w3schools.com'>Learn Web Development!</a>");
}
else
{
document.write("<a href='http://www.refsnesdata.no'>Visit Refsnes Data!</a>");
}
</script>
</body>
</html>
In this code why we use Math.random().
When this generates no. between 0-<1
So If part can be correct and also possibility for else part is equal.
So what's importance of Math.random() here?
Thanks,
S.Singh