In place shuffle of an ndarray
along a specified set of dimensions

@param array     the ndarray to shuffle
@param dimension the dimension to do the shuffle
@return
350373
@Override
    public void shuffle(INDArray array, Random rnd, int... dimension) {
        shuffle(Collections.singletonList(array), rnd, dimension);
    }
557535
public static byte[] concat(byte[]... arrays) {
		int size = 0;
		for (byte[] a: arrays) {
			size += a.length;
		}
		byte[] result = new byte[size];
		int index = 0;
		for (byte[] a: arrays) {
			System.arraycopy(a, 0, result, index, a.length);
			index += a.length;
		}
		return result;
	}
722417
public static void shuffle (Object[] values, int offset, int length)
    {
        shuffle(values, offset, length, _rnd);
    }
1372055
private static function array_shuffle(array &$array)
    {
        for($i = count($array) - 1; $i > 0; $i--)
        {
            $j = mt_rand(0,$i);
            $temp = $array[$i];
            $array[$i] = $array[$j];
            $array[$j] = $temp;
        }
    }
216854
public void shuffle(long seed) {
        // just skip shuffle if there's only 1 example
        if (numExamples() < 2)
            return;

        //note here we use the same seed with different random objects guaranteeing same order

        List<INDArray> arrays = new ArrayList<>();
        List<int[]> dimensions = new ArrayList<>();

        arrays.add(getFeatures());
        dimensions.add(ArrayUtil.range(1, getFeatures().rank()));

        arrays.add(getLabels());
        dimensions.add(ArrayUtil.range(1, getLabels().rank()));

        if (featuresMask != null) {
            arrays.add(getFeaturesMaskArray());
            dimensions.add(ArrayUtil.range(1, getFeaturesMaskArray().rank()));
        }

        if (labelsMask != null) {
            arrays.add(getLabelsMaskArray());
            dimensions.add(ArrayUtil.range(1, getLabelsMaskArray().rank()));
        }

        Nd4j.shuffle(arrays, new Random(seed), dimensions);

        //As per CpuNDArrayFactory.shuffle(List<INDArray> arrays, Random rnd, List<int[]> dimensions) and libnd4j transforms.h shuffleKernelGeneric
        if (exampleMetaData != null) {
            int[] map = ArrayUtil.buildInterleavedVector(new Random(seed), numExamples());
            ArrayUtil.shuffleWithMap(exampleMetaData, map);
        }
    }
1374046
public static void shuffleArray(int[] ar)
    {
        Random rnd = new Random();
        for (int i = ar.length - 1; i > 0; i--)
        {
            int index = rnd.nextInt(i + 1);
            // Simple swap
            int a = ar[index];
            ar[index] = ar[i];
            ar[i] = a;
        }
    }
824205
public static void Shuffle(double[] array, long seed) {
        Random random = new Random();
        if (seed != 0) random.setSeed(seed);

        for (int i = array.length - 1; i > 0; i--) {
            int index = random.nextInt(i + 1);
            double temp = array[index];
            array[index] = array[i];
            array[i] = temp;
        }
    }
1214671
public static void shuffle (Object[] values, Random rnd)
    {
        shuffle(values, 0, values.length, rnd);
    }
1123098
protected function shuffle_assoc(&$array) {
        if (count($array) > 1) {
            // $keys needs to be an array, no need to shuffle 1 item or empty arrays, anyway
            $keys = array_keys($array);
            shuffle($keys);
            foreach($keys as $key) {
                $new[$key] = $array[$key];
            }
            $array = $new;
        }
        return true; // because this behaves like in-built shuffle(), which returns true
    }
634154
public static <T> void shuffleArray(T[] arr) {
		for (int i = arr.length; i > 1; i--)
			swap(arr, i - 1, rand.nextInt(i));
	}
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);
  }
781747
function randomize(array) {
  let n = array.length;

  while (n) {
    n -= 1;
    const i = Math.floor(Math.random() * (n + 1));
    const temp = array[i];
    array[i] = array[n];
    array[n] = temp;
  }

  return array;
}
349466
public static INDArray neq(INDArray x, INDArray y, INDArray z, int... dimensions) {
        if(dimensions == null || dimensions.length == 0) {
            validateShapesNoDimCase(x,y,z);
            return Nd4j.getExecutioner().exec(new OldNotEqualTo(x,y,z));
        }

        return Nd4j.getExecutioner().exec(new BroadcastNotEqual(x,y,z,dimensions));
    }
678734
public static byte[] copy(byte[] array) {
		byte[] newArray = new byte[array.length];
		System.arraycopy(array, 0, newArray, 0, array.length);
		return newArray;
	}
528670
public static void shuffle(double[] doubleArray) {
		int swapPlace = -1;

		for(int i = 0; i < doubleArray.length; i++) {
            swapPlace = (int) (Math.random() * (doubleArray.length - 1 ));
            TrivialSwap.swap(doubleArray, i, swapPlace);
		}
	}
710355
private static void shuffle(int[] a) {
        Random rnd = ThreadLocalRandom.current();
        for (int i = a.length - 1; i > 0; i--) {
            int index = rnd.nextInt(i + 1);
            int e = a[index];
            a[index] = a[i];
            a[i] = e;
        }
    }
615895
public void shuffleColumnValues(ArrayList<String> columns) throws Exception {
		doubleValues.clear();
		ArrayList<String> rows = this.getDataRows();
		for (String column : columns) { //shuffle all values in the column
			ArrayList<Integer> rowIndex = new ArrayList<Integer>();
			for (int i = 0; i < rows.size(); i++) {
				rowIndex.add(i);
			}
			Collections.shuffle(rowIndex);
			for (int i = 0; i < rows.size(); i++) {
				String row = rows.get(i);
				int randomIndex = rowIndex.get(i);
				String destinationRow = rows.get(randomIndex);


				String temp = this.getCell(destinationRow, column);
				String value = this.getCell(row, column);
				this.addCell(destinationRow, column, value);
				this.addCell(row, column, temp);
			}
		}

	}