Log in

View Full Version : Need a random number generator


NiugnepKing
12-27-2002, 01:59 AM
I was wondering if anyone had any info on...

(a) programming a random number generator ~ How I would do this, what programs I would need, etc.

(b) downloading a RNG ~ Are there ones out there already? If so, I'd prefer for ones that are free, but a trial version would suffice.

(c) programming a RNG for me ~ If you have the tech savvy and are willing, it would be great. I'll let you know the things I'd like, which isn't too much.

By the way, I run a Dell Axim. Not sure on what other specs are needed.

Thanks in advance.

andyclap
12-31-2002, 02:23 PM
A simple way of doing this is with a little HTML+Javascript.
Cut and paste the following into a text file, and save it as something like Rnd.htm. Then copy this file to your PPC, and open the file in file explorer.
It should be fairly straightforward to follow...
Note - this requires PocketPC2002, as it uses the innerHTML property.


<html>
<head>
<title>RND</title>
</head>
<body>
<h1>Simple Random Number Generator</h1>
From: <input id="txtFrom" name="txtFrom" value="1"><br>
To: <input id="txtTo" name="txtTo" value="100"><br>
<input type="button" value="Go!" onclick="javascript:ShowRnd();"><br>
Result: <span id="spnResult">???</span>
<script language=javascript>
function ShowRnd()
{
var lFrom, lTo, lResult;
lFrom=parseInt(txtFrom.value)
if (isNaN(lFrom))
alert("Enter a number to start from");
else
{
lTo=parseInt(txtTo.value)
if (isNaN(lTo))
alert("Enter a number to run to");
else
{
lResult=Math.floor(Math.random()*(lTo-lFrom+1))+lFrom;
spnResult.innerHTML="<b>" + lResult.toString() + "</b>";
}
}
}
</script>
</body>
</html>