Randomly shuffle the elements in an array

@param <E> the type of elements in this arrays.

@param array an array of objects to shuffle.
178634
public static <E> void shuffle(E[] array) {
		int swapPlace = -1;
		
		for(int i = 0; i < array.length; i++) {
            swapPlace = (int) (Math.random() * (array.length - 1 ));
            TrivialSwap.swap(array, i, swapPlace);
		}
	}
1214671
public static void shuffle (Object[] values, Random rnd)
    {
        shuffle(values, 0, values.length, rnd);
    }
1220426
public static void sampleWithoutReplacement(int[] array, int numArgClasses, Random rand) {
    int[] temp = new int[numArgClasses];
    for (int i = 0; i < temp.length; i++) {
      temp[i] = i;
    }
    shuffle(temp, rand);
    System.arraycopy(temp, 0, array, 0, array.length);
  }
1225207
public static void shuffle(final int[] arr, final Random rng) {
    // Fisher-Yates shuffle
    for (int i = arr.length; i > 1; i--) {
      // swap i-1 and a random spot
      final int a = i - 1;
      final int b = rng.nextInt(i);

      final int tmp = arr[b];
      arr[b] = arr[a];
      arr[a] = tmp;
    }
  }
1208010
public static void shuffle(byte[] byteArray) {
		int swapPlace = -1;

		for(int i = 0; i < byteArray.length; i++) {
			swapPlace = (int) (Math.random() * (byteArray.length - 1 ));
			XORSwap.swap(byteArray, i, swapPlace);
		}
	}
59025
@Override
    public ListT<W,T> shuffle(final Random random) {

        return (ListT<W,T>) FoldableTransformerSeq.super.shuffle(random);
    }
850405
public static <E extends Comparable<E>> void sort(E[] intArray) {
        Quicksort.sort(intArray, 0, intArray.length - 1 , false);
    }
329752
public void randomize(Random random) {
        for (int j = numInstances() - 1; j > 0; j--) {
            swap(j, random.nextInt(j + 1));
        }
    }
1027633
public void add(IntArray array)
  {
    if (_data.length <= array._size)
      expand(_size + array._size);

    for (int i = 0; i < array._size; i++)
      _data[_size++] = array._data[i];
  }
129186
public static int[] shuffleIndices (int length, RandomGenerator randomGenerator) {
        // Initialize indices:
        final int[] indices = IntStream.range(0, length).toArray();

        // Shuffle the array:
        MathArrays.shuffle(indices, randomGenerator);

        // Done return shuffled indices:
        return indices;
    }
62685
function shuffle(data) {
    // Convert the string to an array
    var content = (typeof data === 'string' ? data.split('') : data);

    // Perform the shuffle on the array
    for (var length = content.length - 1; length > 0; length--) {
      var index = Math.floor(Math.random() * (length + 1));
      var temp = content[length];
      content[length] = content[index];
      content[index] = temp;
    }

    return content.join('');
  }
499758
public static void sort(double[] doubleArray) {
        boolean swapped = true;
        
        while(swapped) {
            swapped = false;
            
            for(int i = 0; i < (doubleArray.length - 1 ); i++) {
                if(doubleArray[i] > doubleArray[i + 1]) {
                    TrivialSwap.swap(doubleArray, i, i + 1);
                    
                    swapped = true;
                }
            }            
        }
    }
676566
public static <T> T randomFrom(T[] array) {
    checkArgument(isNotEmpty(array), "Array cannot be empty");
    return IterableUtils.randomFrom(Arrays.asList(array));
  }
442531
public static void reorder(int[] array, int[] order) {
        int[] original = copyOf(array);
        for (int i = 0; i < array.length; i++) {
            array[i] = original[order[i]];
        }
    }
951330
public static <E> void swap(E[] array, int index1, int index2) {
        TrivialSwap.swap(array, index1, array, index2);
    }
1211205
public static <E extends Comparable<E>> void sort(E[] array) {
        boolean swapped = true;
        
        while(swapped) {
            swapped = false;
            
            for(int i = 0; i < (array.length - 1 ); i++) {
                if(array[i].compareTo(array[i + 1]) > 0) {
                    TrivialSwap.swap(array, i, i + 1);
                    
                    swapped = true;
                }
            }            
        }
    }
1229928
public static void sort(long[] longArray) {
        boolean swapped = true;
        
        while(swapped) {
            swapped = false;
            
            for(int i = 0; i < (longArray.length - 1 ); i++) {
                if(longArray[i] > longArray[i + 1]) {
                    TrivialSwap.swap(longArray, i, i + 1);
                    
                    swapped = true;
                }
            }            
        }
    }