v0.6.0: moved important usages of collections.shuffle into Random
This commit is contained in:
committed by
Evan Debenham
parent
75f9cd454b
commit
048b5e5f7b
@@ -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++) {
|
||||
|
||||
Reference in New Issue
Block a user