package de.cdietze.ld37.core;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;

public class MathUtils {

  public static List<Integer> shuffledRange(int size, Random random) {
    ArrayList<Integer> list = new ArrayList<>(size);
    for (int i = 0; i < size; ++i) list.add(i);
    Collections.shuffle(list, random);
    return list;
  }
}

@@ -333,16 +333,105 @@
 i);%0A    
+shuffle(list, random);%0A    return list;%0A  %7D%0A%0A  /** GWT does not emulate %7B@link java.util.
 Collecti
@@ -437,17 +437,17 @@
 ions
-.
+#
 shuffle(
 list
@@ -446,39 +446,232 @@
 fle(
-list, random);%0A    return list;
+List, Random)%7D */%0A  public static void shuffle(List%3C?%3E list, Random random) %7B%0A    for (int index = 0; index %3C list.size(); index += 1) %7B%0A      Collections.swap(list, index, index + random.nextInt(list.size() - index));%0A    %7D
 %0A  %7D

Fix for GWT’s missing collections.shuffle