Fix: shuffle bag initially

This commit is contained in:
pfirpfel
2020-10-22 13:20:32 +02:00
parent 1f2c41a729
commit dd1642670f

View File

@@ -19,6 +19,7 @@ public class BagRandomizer<T > implements Iterable<T>{
public BagRandomizer(T[] items) { public BagRandomizer(T[] items) {
bag = items; bag = items;
shuffleBag();
} }
public BagRandomizer(Iterable<T> items) { public BagRandomizer(Iterable<T> items) {
@@ -27,6 +28,7 @@ public class BagRandomizer<T > implements Iterable<T>{
list.add(item); list.add(item);
} }
bag = (T[]) list.toArray(); bag = (T[]) list.toArray();
shuffleBag();
} }
public T getNextItem() { public T getNextItem() {