v0.6.0: moved important usages of collections.shuffle into Random

This commit is contained in:
Evan Debenham
2017-04-14 04:55:26 -04:00
committed by Evan Debenham
parent 75f9cd454b
commit 048b5e5f7b
4 changed files with 10 additions and 4 deletions

View File

@@ -22,7 +22,9 @@
package com.watabou.utils;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
public class Random {
@@ -156,6 +158,10 @@ public class Random {
(T)collection.toArray()[Int( size )] :
null;
}
public static<T> void shuffle( List<?extends T> list){
Collections.shuffle(list, rand);
}
public static<T> void shuffle( T[] array ) {
for (int i=0; i < array.length - 1; i++) {