[thelist] Re: Javascript: randomizing persistent text rotator

Chris Blessing webguy at mail.rit.edu
Mon Mar 25 21:04:01 CST 2002


Hey Tim-

Your best bet is to have a variable hold the last randomly-generated number,
then use a while loop to check the next generated number against the last
one.  If they're the same, then generate another random number and check it
again until they don't match, THEN execute the rotate function as you have
it.  See if you can get it down with code, lemme know how it turns out!

Good luck,

Chris Blessing
webguy at mail.rit.edu
http://www.330i.net

> Thanks Chris. Yes I noticed that, but wasn't sure why the frequent pause
> was happening. How might I get started fixing this? I had assumed
> Math.floor(Math.random()*txtStr.length) would prevent said behavior, but
> I guess not.
>
> Current version: http://home.hawaii.rr.com/timfm/theList/rotator_2.html
>
> //t




More information about the thelist mailing list