|
SSJ V. 2.6. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object umontreal.iro.lecuyer.rng.RandomPermutation
public class RandomPermutation
Provides methods to randomly shuffle arrays or lists using a random stream.
Constructor Summary | |
---|---|
RandomPermutation()
|
Method Summary | |
---|---|
static void |
init(byte[] array,
int n)
Initializes array with the first n positive integers in natural order as array[i - 1] = i, for i = 1,..., n. |
static void |
init(double[] array,
int n)
Similar to init (byte[], int). |
static void |
init(float[] array,
int n)
Similar to init (byte[], int). |
static void |
init(int[] array,
int n)
Similar to init (byte[], int). |
static void |
init(long[] array,
int n)
Similar to init (byte[], int). |
static void |
init(short[] array,
int n)
Similar to init (byte[], int). |
static void |
shuffle(boolean[] array,
int n,
int k,
RandomStream stream)
Similar to shuffle (Object[], n, k, RandomStream). |
static void |
shuffle(boolean[] array,
RandomStream stream)
Similar to shuffle (byte[], RandomStream). |
static void |
shuffle(byte[] array,
int n,
int k,
RandomStream stream)
Similar to shuffle (Object[], n, k, RandomStream). |
static void |
shuffle(byte[] array,
RandomStream stream)
Randomly permutes array using stream. |
static void |
shuffle(char[] array,
int n,
int k,
RandomStream stream)
Similar to shuffle (Object[], n, k, RandomStream). |
static void |
shuffle(char[] array,
RandomStream stream)
Similar to shuffle (byte[], RandomStream). |
static void |
shuffle(double[] array,
int n,
int k,
RandomStream stream)
Similar to shuffle (Object[], n, k, RandomStream). |
static void |
shuffle(double[] array,
RandomStream stream)
Similar to shuffle (byte[], RandomStream). |
static void |
shuffle(float[] array,
int n,
int k,
RandomStream stream)
Similar to shuffle (Object[], n, k, RandomStream). |
static void |
shuffle(float[] array,
RandomStream stream)
Similar to shuffle (byte[], RandomStream). |
static void |
shuffle(int[] array,
int n,
int k,
RandomStream stream)
Similar to shuffle (Object[], n, k, RandomStream). |
static void |
shuffle(int[] array,
RandomStream stream)
Similar to shuffle (byte[], RandomStream). |
static void |
shuffle(List<?> list,
int k,
RandomStream stream)
|
static void |
shuffle(List<?> list,
RandomStream stream)
|
static void |
shuffle(long[] array,
int n,
int k,
RandomStream stream)
Similar to shuffle (Object[], n, k, RandomStream). |
static void |
shuffle(long[] array,
RandomStream stream)
Similar to shuffle (byte[], RandomStream). |
static void |
shuffle(Object[] array,
int n,
int k,
RandomStream stream)
Partially permutes array as follows using stream: draws the new k elements, array[0] to array[k-1], randomly among the old n elements, array[0] to array[n-1], assuming that k <= n <= array.length. |
static void |
shuffle(Object[] array,
RandomStream stream)
Randomly permutes array using stream. |
static void |
shuffle(short[] array,
int n,
int k,
RandomStream stream)
Similar to shuffle (Object[], n, k, RandomStream). |
static void |
shuffle(short[] array,
RandomStream stream)
Similar to shuffle (byte[], RandomStream). |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RandomPermutation()
Method Detail |
---|
public static void init(byte[] array, int n)
array
- the array to initialize.n
- number of elements initialized.public static void init(short[] array, int n)
init
(byte[], int).
array
- the array to initialize.n
- number of elements initialized.public static void init(int[] array, int n)
init
(byte[], int).
array
- the array to initialize.n
- number of elements initialized.public static void init(long[] array, int n)
init
(byte[], int).
array
- the array to initialize.n
- number of elements initialized.public static void init(float[] array, int n)
init
(byte[], int).
array
- the array to initialize.n
- number of elements initialized.public static void init(double[] array, int n)
init
(byte[], int).
array
- the array to initialize.n
- number of elements initialized.public static void shuffle(List<?> list, RandomStream stream)
public static void shuffle(Object[] array, RandomStream stream)
array
- the array being shuffled.stream
- the random stream used to generate random numbers.public static void shuffle(byte[] array, RandomStream stream)
array
- the array being shuffled.stream
- the random stream used to generate random numbers.public static void shuffle(short[] array, RandomStream stream)
shuffle
(byte[], RandomStream).
array
- the array being shuffled.stream
- the random stream used to generate random numbers.public static void shuffle(int[] array, RandomStream stream)
shuffle
(byte[], RandomStream).
array
- the array being shuffled.stream
- the random stream used to generate random numbers.public static void shuffle(long[] array, RandomStream stream)
shuffle
(byte[], RandomStream).
array
- the array being shuffled.stream
- the random stream used to generate random numbers.public static void shuffle(char[] array, RandomStream stream)
shuffle
(byte[], RandomStream).
array
- the array being shuffled.stream
- the random stream used to generate random numbers.public static void shuffle(boolean[] array, RandomStream stream)
shuffle
(byte[], RandomStream).
array
- the array being shuffled.stream
- the random stream used to generate random numbers.public static void shuffle(float[] array, RandomStream stream)
shuffle
(byte[], RandomStream).
array
- the array being shuffled.stream
- the random stream used to generate random numbers.public static void shuffle(double[] array, RandomStream stream)
shuffle
(byte[], RandomStream).
array
- the array being shuffled.stream
- the random stream used to generate random numbers.public static void shuffle(List<?> list, int k, RandomStream stream)
public static void shuffle(Object[] array, int n, int k, RandomStream stream)
array
- the array being shuffled.n
- selection amongst the first n elements.k
- number of elements selected.stream
- the random stream used to generate random numbers.public static void shuffle(byte[] array, int n, int k, RandomStream stream)
shuffle
(Object[], n, k, RandomStream).
array
- the array being shuffled.n
- selection amongst the first n elements.k
- number of elements selected.stream
- the random stream used to generate random numbers.public static void shuffle(short[] array, int n, int k, RandomStream stream)
shuffle
(Object[], n, k, RandomStream).
array
- the array being shuffled.n
- selection amongst the first n elements.k
- number of elements selected.stream
- the random stream used to generate random numbers.public static void shuffle(int[] array, int n, int k, RandomStream stream)
shuffle
(Object[], n, k, RandomStream).
array
- the array being shuffled.n
- selection amongst the first n elements.k
- number of elements selected.stream
- the random stream used to generate random numbers.public static void shuffle(long[] array, int n, int k, RandomStream stream)
shuffle
(Object[], n, k, RandomStream).
array
- the array being shuffled.n
- selection amongst the first n elements.k
- number of elements selected.stream
- the random stream used to generate random numbers.public static void shuffle(char[] array, int n, int k, RandomStream stream)
shuffle
(Object[], n, k, RandomStream).
array
- the array being shuffled.n
- selection amongst the first n elements.k
- number of elements selected.stream
- the random stream used to generate random numbers.public static void shuffle(boolean[] array, int n, int k, RandomStream stream)
shuffle
(Object[], n, k, RandomStream).
array
- the array being shuffled.n
- selection amongst the first n elements.k
- number of elements selected.stream
- the random stream used to generate random numbers.public static void shuffle(float[] array, int n, int k, RandomStream stream)
shuffle
(Object[], n, k, RandomStream).
array
- the array being shuffled.n
- selection amongst the first n elements.k
- number of elements selected.stream
- the random stream used to generate random numbers.public static void shuffle(double[] array, int n, int k, RandomStream stream)
shuffle
(Object[], n, k, RandomStream).
array
- the array being shuffled.n
- selection amongst the first n elements.k
- number of elements selected.stream
- the random stream used to generate random numbers.
|
SSJ V. 2.6. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |