示例#1
0
 public void shuffle() {
   T[] items = this.items;
   for (int i = size - 1; i >= 0; i--) {
     int ii = MathUtils.random(i);
     T temp = items[i];
     items[i] = items[ii];
     items[ii] = temp;
   }
 }
示例#2
0
 public T random() {
   if (size == 0) return null;
   return items[MathUtils.random(0, size - 1)];
 }