/    Sign up×
Community /Pin to ProfileBookmark

Random "set" of images

I’m posting this here, but it probably could go in a lot of other forums ?

Anyway does anyone know if there’s a script out there (java, php, cgi…) that allows me to make a number of images display at random, but “in the same way”

As in, say i have 3 images on my page, each image exists in 3 different colors, red blue and green. Is there a script than will random generate the 3 images, but in the same color (so the color of the pics is random, because they generate together, in a “set” or the same color).

Please help!

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceJun 06.2006 — Sure. Non-language-specific... Just set up a 2-dimensional array -- where the different colors are the 1st dimension and the different images are the second dimension. Then, a single random number calculation will give you which color to display:

pics[color][0]

pics[color][1]

pics[color][2]
Copy linkTweet thisAlerts:
@The_Fred_FactorauthorJun 06.2006 — you don't think you could push it a little further do you? because I understand what you mean, but wouldn't know how on earth to do it!
Copy linkTweet thisAlerts:
@phpnoviceJun 06.2006 — pics = new Array(
new Array('redone.jpg', 'redtwo.jpg', 'redthree.jpg'),
new Array('greenone.jpg', 'greentwo.jpg', 'greenthree.jpg'),
new Array('blueone.jpg', 'bluetwo.jpg', 'bluethree.jpg')
);
var color = Math.floor(Math.random() * pics.length);
alert(pics[color][0] + ", " + pics[color][1] + ", " + pics[color][2]);
×

Success!

Help @The_Fred_Factor spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...