Netscape 4.8 Math Random Hangup

Giganews Newsgroups
Subject: Netscape 4.8 Math Random Hangup
Posted by:  Pyt…@comcast.net (R. Russell Kinter)
Date: 19 Jul 2003

Hi all,
First of all I am fairly new to javascript. Most of my experience has
been with
its subset vrmlscript, so have mercy.
The following script works in I.E. 5.5, but hangs up in Netscape 4.8
(also works in vrmlscript for blaxxun Contact vrml plugin)
The general idea is to make Math.random() more "random" by calling it
x number
of times. X would would be decimal places taken from a time stamp, but
in this simplified example it is just 75.
Any ideas on how to keep it from hanging in Netscape?

thanx
Russ Kinter

<HTML>

<HEAD>

<SCRIPT language='Javascript1.2'>

function count(a){
var c = 0;
var d = new Array;
with (Math){
for(var b = 0;b<=a;b++){  d[b] = random();
if(b==a){c = round(77*d[b]);}}}
document.writeln(c);}

</SCRIPT >
</HEAD>

<BODY>
<H2>Example</H2>
<FORM>
<INPUT TYPE="button" NAME="Example" onClick="count(75)">
</FORM>
</BODY>
</HTML>

Replies