mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 04:42:07 -08:00
Add files via upload
This commit is contained in:
parent
670917c3cb
commit
a5f14d61dd
1 changed files with 12 additions and 0 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue