I'm trying to create a method which contains a loop that can create new Raindrop
objects and insert them into a list. Each Raindrop
object has a constructor which takes an int, which represents the Z index of a rain drop.
Now the problem is that I want to create more drops with a lower z index than with a higher.
I have this method:
public void createRainDrops(int amount, int startIndex, endIndex) {
for (int i=0; i<=amount; i++) {
//what goes here?
dropList.add(new Drop(zIndex));
}
}
When I call createRainDrops(500, 10, 20);
I would expect something like this:
10x Drops with index 20,
20x Drops with index 19,
30x Drops with index 18,
40x Drops with index 17,
...
Most drops with index 10
Or something similar. I don't have an exact algorithm in my head, neither how the split should be done exactly. Just more drops with a lower z index, than with a higher.