Java Array Shuffle shuffle(Object[] objs, Random random, int start, int len)

Here you can find the source of shuffle(Object[] objs, Random random, int start, int len)

Description

shuffle

License

Open Source License

Declaration

public static void shuffle(Object[] objs, Random random, int start, int len) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Random;

public class Main {
    public static void shuffle(Object[] objs, Random random, int start, int len) {
        for (int i = 0; i < len; i++) {
            int j = random.nextInt(len);
            Object tmp = objs[i];
            objs[i] = objs[j];/* ww w  . j a  v  a 2  s.  com*/
            objs[j] = tmp;
        }
    }

    public static void shuffle(Object[] objs, Random random) {
        shuffle(objs, random, 0, objs.length);
    }
}

Related

  1. shuffle(List list)
  2. shuffle(List list, int nswaps)
  3. shuffle(Object[] a)
  4. shuffle(Object[] a, Random r)
  5. shuffle(Object[] array)
  6. shuffle(Random rand, O[] array)
  7. shuffle(short... a)
  8. shuffle(String str, Random randObj)
  9. shuffle(T[] a, int from, int to, Random rnd)