i have a bunch of images
1.jpg, 2.jpg etc..
I have a class called banner and wondering how to get it to randomised threw the pics?
Thanks
read the filenames into a List, generate a sequence of random numbers, et voila.
but have ya got any examples of this?
You should be able to defer the code from what I wrote.
It's simple really.
List map = new ArrayList();
// loop through files
while (files.hasNext()) {
map.add(files.next());
}
or something like that.
That's of course not complete code but should serve as a starting point ;)
Use a Random object or something:
Random random = new Random(2);
int rotation = random.nextInt()+1;
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.