Can someone explain to me how the following JS script works
<p>The script below works fine but i just dont understand how it works especally the following section:  Math.floor(Math.random() * 101);. can somebody please explain the how the whole script works. thank you.</p>

<pre><code>&lt;SCRIPT LANGUAGE="Javascript"&gt;
var num = Math.floor(Math.random() * 101);

function guessnum() {

    var guess = document.forms["form1"].num.value;
    if (guess == num) {
        alert("Great you Guessed! How did you know that?");
    }

    if (guess &lt; num) {
        alert("No your number is too low!");
    }

    if (guess &gt; num) {
        alert("No your number is too  high");
    }

}
&lt;/SCRIPT&gt;
</code></pre>
