Add files via upload

This commit is contained in:
tiera3 2024-10-02 15:00:37 +10:00 committed by GitHub
parent 670917c3cb
commit a5f14d61dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -25,6 +25,18 @@ public class Rotater<T> {
this(true, item1, item2);
}
public Rotater(boolean keepOrder, T... items) {
if (keepOrder) {
this.items = Arrays.asList(items);
this.position = RandomUtil.nextInt(this.items.size());
} else {
this.items = new ArrayList<T>();
Collections.addAll(this.items, items);
Collections.shuffle(this.items, RandomUtil.getRandom());
this.position = 0;
}
}
public int numItems() {
return items.size();
}