Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 02-06-2003, 12:00 AM   #1
lil2rich4u2
ICQ: 175171926
 
Join Date: Oct 2002
Location: New York, NY
Posts: 11,046
Hey JavaScript Guru's!

Ok i have this script that takes 2 items out of an array, then checks to make sure they arent identical.

Id like to boost this to 20 numbers, but i dont know how to structure the CHECK part.

Here is the check im using for the existing 2 item script ...

var s1=Math.floor(Math.random()*myimages.length)
if (s1==0)
s1=1
var s2=Math.floor(Math.random()*myimages.length)
if (s2==0)
s2=1

if(s1==s2){ if(s1==myimages.length) {s1=1;} else s1++; }



Now i need 20 items from my array without duplicating any of them, lol

Any ideas?
lil2rich4u2 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-06-2003, 07:03 AM   #2
The Hun
Confirmed User
 
The Hun's Avatar
 
Join Date: Jan 2001
Location: The Netherlands
Posts: 1,207
Keep an array of items you already selected. Then select untill you get an item from the original list that wasn't selected yet. Add that to the array of items you already selected. Be careful though: if you have less items in your original list than you want to select you could end up in an endless loop
The Hun is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.