[jQuery] Re: jQuery - Random Selection

2009-10-04 Thread Matthew Wehrle
Cheers for the help guys. I get exactly what you're driving at, but as I am a complete Javascript newb I have no idea how to put all of that code into my script. If you could be a bit more specific that'd be awesome. Cheers again, Matt.

[jQuery] Re: jQuery - Random Selection

2009-10-03 Thread Charlie
put all the bios in containers with same class, use _javascript_ random() function to create a random index to show one of the bios $('.bioClass').hide() var bioIndex=Math.round(Math.random()*5) $('.bioClass').eq(bioIndex).show() random() generates random # between 0 and 1 so multiplying by

[jQuery] Re: jQuery - Random Selection

2009-10-03 Thread RobG
On Oct 4, 7:06 am, Charlie charlie...@gmail.com wrote: put all the bios in  containers with same class, use javascript random() function to create a random index to show one of the bios $('.bioClass').hide() var bioIndex=Math.round(Math.random()*5) Using that formula, indices 0 and 5 have

[jQuery] Re: jQuery - Random Selection

2009-10-03 Thread RobG
On Oct 4, 2:45 pm, RobG robg...@gmail.com wrote: [...] which is the same as using Math.floor. To return a random integer between 0 and n, use: That should have been: between 0 and n-1 inclusive.   function getRandomInt(n) {     return Math.random()*n | 0;   } -- Rob