Randef
<html>
<head>
<script type="text/javascript">
function randInt(low,high){
    return low+Math.floor(Math.random()*(high-low+1));
}
function simulate(){
    var Form = document.input;
    var x = Form.rollMe.value;
    var y = Form.rollYou.value;
    var me = 0;
    var you = 0;
    for(var i=1;i<=100;i++){
        if(randInt(1,x)>=randInt(1,y)) me++;
        else you++;
    }
    Form.scoreMe.value = me;
    Form.scoreYou.value = you;
}
function compare(){
    var Form = document.input;
    var x = Form.rollMe.value;
    var y = Form.rollYou.value;
    var me = 0;
    var you = 0;
    if(randInt(1,x)>=randInt(1,y)) me++;
    else you++;
    Form.scoreMe.value = me;
    Form.scoreYou.value = you;
}
</script>
</head>
<body>
<form name="input">
Me: <input name="rollMe" /> <input name="scoreMe" /><br />
You: <input name="rollYou" /> <input name="scoreYou" /><br />
<input type="button" value="Simulate" onClick="simulate();" /> &nbsp;
<input type="button" value="Compare" onClick="compare();" />
</form>
</body>
</html>
Please refer to the Legal Guidelines for license information.