Sorry!
I should not have been so rude, but I was annoyed by your curt reply.
This was not that helpful. It is true, I just started visiting here
last week. And until I saw the footer on your reply, I did not know
where to find the FAQ. I must say they are very informative. I was
really impressed and bookmarked them. I am sure they will be a great
asset as I try to learn JavaScript.
Your explanation was much more helpful, and I immediately understood
the your point.
When you use Math.round in that manner, you are not choosing at random.
The first and last options are only half as probable as the others.
Choosing at random, which is what the OP asked for, and what your
comment claims that you are doing, means that all possibilities must be
substantially equi-probable.
Since, at first, I misunderstood your reasoning, perhaps my irritation
was justified. I thought your objection was the possibility of
Math.round(...) giving 25, while pix[25] did not exist. I was more
embarassed by this novice mistake, then the fact that the
nonsequential display of slides would not be statistically random.
Finally, I must object to the implication that only the masters may
contribute here. I alway found a seminar more stimulating then a
lecture. Certianly, this dialog has thought me two important
lessions--the proper way to find a random number and to keep my foot
out of my mouth. I only posted my solution, because a previous reply
indicated it was necessary to use some server-side technique. Since I
am currently writing a script to sequentially loop through a set of
images, I checked either Goodman's or Flaganan's book for
Math.random(), and quickly modified currImg++. In the future, I
promise to think, proof-read and test before posting. (That reminds
me, I need to take a red pen to that book. I'm sure the example used
Math.round())
Please accept my apology and thanks.
Ron