Click to See Complete Forum and Search --> : picking random numbers


bossgobbler
04-08-2003, 04:22 PM
I want to be able to get random numbers between 1 and 50 but the random method only gets random numbers between 0 & 1. Do any of you know of a good way to do this?

Jona
04-08-2003, 04:25 PM
<html><head>
<script>
function foo(){
document.formName.inputFieldName.value=Math.floor(Math.random()*(1, 50));}
</script>
</head><body>
<form name="formName">
<input type=text name="inputFieldName">
<input type=button value="bar" onclick="foo()">
</form></body></html>

Jona
04-08-2003, 05:54 PM
Sorry, Dave. I messed up there. I should've known that... :p