SSJ
3.3.1
Stochastic Simulation in Java
|
Provides methods to randomly shuffle arrays or lists using a random stream. More...
Static Public Member Functions | |
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\). More... | |
static void | init (short[] array, int n) |
Similar to init(byte[], int). More... | |
static void | init (int[] array, int n) |
Similar to init(byte[], int). More... | |
static void | init (long[] array, int n) |
Similar to init(byte[], int). More... | |
static void | init (float[] array, int n) |
Similar to init(byte[], int). More... | |
static void | init (double[] array, int n) |
Similar to init(byte[], int). More... | |
static void | shuffle (List<?> list, RandomStream stream) |
Same as java.util.Collections.shuffle(List<?>, Random) , but uses a RandomStream instead of java.util.Random . More... | |
static void | shuffle (Object[] array, RandomStream stream) |
Randomly permutes array using stream . More... | |
static void | shuffle (byte[] array, RandomStream stream) |
Randomly permutes array using stream . More... | |
static void | shuffle (short[] array, RandomStream stream) |
Similar to shuffle(byte[], RandomStream). More... | |
static void | shuffle (int[] array, RandomStream stream) |
Similar to shuffle(byte[], RandomStream). More... | |
static void | shuffle (long[] array, RandomStream stream) |
Similar to shuffle(byte[], RandomStream). More... | |
static void | shuffle (char[] array, RandomStream stream) |
Similar to shuffle(byte[], RandomStream). More... | |
static void | shuffle (boolean[] array, RandomStream stream) |
Similar to shuffle(byte[], RandomStream). More... | |
static void | shuffle (float[] array, RandomStream stream) |
Similar to shuffle(byte[], RandomStream). More... | |
static void | shuffle (double[] array, RandomStream stream) |
Similar to shuffle(byte[], RandomStream). More... | |
static void | shuffle (List<?> list, int k, RandomStream stream) |
Partially permutes list as follows using stream : draws the first \(k\) new elements of list randomly among the \(n\) old elements of list , assuming that \(k \le n = \) list.size() . More... | |
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 \le n \le\) array.length . More... | |
static void | shuffle (byte[] array, int n, int k, RandomStream stream) |
Similar to shuffle(Object[], n, k, RandomStream). More... | |
static void | shuffle (short[] array, int n, int k, RandomStream stream) |
Similar to shuffle(Object[], n, k, RandomStream). More... | |
static void | shuffle (int[] array, int n, int k, RandomStream stream) |
Similar to shuffle(Object[], n, k, RandomStream). More... | |
static void | shuffle (long[] array, int n, int k, RandomStream stream) |
Similar to shuffle(Object[], n, k, RandomStream). More... | |
static void | shuffle (char[] array, int n, int k, RandomStream stream) |
Similar to shuffle(Object[], n, k, RandomStream). More... | |
static void | shuffle (boolean[] array, int n, int k, RandomStream stream) |
Similar to shuffle(Object[], n, k, RandomStream). More... | |
static void | shuffle (float[] array, int n, int k, RandomStream stream) |
Similar to shuffle(Object[], n, k, RandomStream). More... | |
static void | shuffle (double[] array, int n, int k, RandomStream stream) |
Similar to shuffle(Object[], n, k, RandomStream). More... | |
Provides methods to randomly shuffle arrays or lists using a random stream.
|
static |
Initializes array
with the first \(n\) positive integers in natural order as array
\([i-1] = i\), for \(i=1,...,n\).
The size of array
must be at least \(n\).
array | the array to initialize. |
n | number of elements initialized. |
|
static |
Similar to init(byte[], int).
array | the array to initialize. |
n | number of elements initialized. |
|
static |
Similar to init(byte[], int).
array | the array to initialize. |
n | number of elements initialized. |
|
static |
Similar to init(byte[], int).
array | the array to initialize. |
n | number of elements initialized. |
|
static |
Similar to init(byte[], int).
array | the array to initialize. |
n | number of elements initialized. |
|
static |
Similar to init(byte[], int).
array | the array to initialize. |
n | number of elements initialized. |
|
static |
Same as java.util.Collections.shuffle(List<?>, Random)
, but uses a RandomStream instead of java.util.Random
.
list | the list being shuffled. |
stream | the random stream used to generate integers. |
|
static |
Randomly permutes array
using stream
.
This method permutes the whole array.
array | the array being shuffled. |
stream | the random stream used to generate random numbers. |
|
static |
Randomly permutes array
using stream
.
This method permutes the whole array.
array | the array being shuffled. |
stream | the random stream used to generate random numbers. |
|
static |
Similar to shuffle(byte[], RandomStream).
array | the array being shuffled. |
stream | the random stream used to generate random numbers. |
|
static |
Similar to shuffle(byte[], RandomStream).
array | the array being shuffled. |
stream | the random stream used to generate random numbers. |
|
static |
Similar to shuffle(byte[], RandomStream).
array | the array being shuffled. |
stream | the random stream used to generate random numbers. |
|
static |
Similar to shuffle(byte[], RandomStream).
array | the array being shuffled. |
stream | the random stream used to generate random numbers. |
|
static |
Similar to shuffle(byte[], RandomStream).
array | the array being shuffled. |
stream | the random stream used to generate random numbers. |
|
static |
Similar to shuffle(byte[], RandomStream).
array | the array being shuffled. |
stream | the random stream used to generate random numbers. |
|
static |
Similar to shuffle(byte[], RandomStream).
array | the array being shuffled. |
stream | the random stream used to generate random numbers. |
|
static |
Partially permutes list
as follows using stream
: draws the first \(k\) new elements of list
randomly among the \(n\) old elements of list
, assuming that \(k \le n = \) list.size()
.
In other words, \(k\) elements are selected at random without replacement from the \(n\) list
entries and are placed in the first \(k\) positions, in random order.
list | the list being shuffled. |
k | number of elements selected. |
stream | the random stream used to generate integers. |
|
static |
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 \le n \le\) array.length
.
In other words, \(k\) elements are selected at random without replacement from the first \(n\) array elements and are placed in the first \(k\) positions, in random order.
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. |
|
static |
Similar to 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. |
|
static |
Similar to 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. |
|
static |
Similar to 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. |
|
static |
Similar to 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. |
|
static |
Similar to 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. |
|
static |
Similar to 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. |
|
static |
Similar to 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. |
|
static |
Similar to 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. |