|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--edu.neu.ccs.util.ProbStatTools
Class ProbStatTools collects static methods that
are useful for randomization, probability, and statistics.
| Method Summary | |
static int[] |
integerSequence(int n)
Returns an array with the integers in sequence: 0, 1, etc, up to (n-1). |
static int[] |
randomPermutation(int n)
Returns an array whose contents is a random permutation of the integers from 0 to (n-1). |
static int[] |
randomPermutation(int[] data)
Returns an array whose contents is a random permutation of the contents in the data array. |
static int[] |
repeatData(int[] data,
int k)
Returns an int array that repeats the data in the given array sequentially k times. |
static int[] |
selectWithNoRepetition(int[] data,
int k)
Returns an array whose contents is a random selection of k elements from the contents of the given data with no repetition of a selected index. |
static int[] |
selectWithNoRepetition(int n,
int k)
Returns an array of length k consisting of integers chosen from 0 to (n-1) with no repetition permitted. |
static int[] |
selectWithRepetition(int[] data,
int k)
Returns an array whose contents is a random selection of k elements from the contents of the given data with repetition of a selected index permitted. |
static int[] |
selectWithRepetition(int n,
int k)
Returns an array of length k consisting of integers chosen from 0 to (n-1) with repetition permitted. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static int[] integerSequence(int n)
Returns an array with the integers in sequence: 0, 1, etc, up to (n-1).
If n is less than or equal to zero, then returns an empty array of integers.
public static int[] selectWithRepetition(int n,
int k)
Returns an array of length k consisting of integers chosen from 0 to (n-1) with repetition permitted.
If n or k is less than or equal to zero, then returns an empty array of integers.
public static int[] selectWithNoRepetition(int n,
int k)
Returns an array of length k consisting of integers chosen from 0 to (n-1) with no repetition permitted.
If k is less than or equal to zero or greater than n, then returns an empty array of integers.
public static int[] randomPermutation(int n)
Returns an array whose contents is a random permutation of the integers from 0 to (n-1).
If n is less than or equal to zero, then returns an empty array of integers.
public static int[] selectWithRepetition(int[] data,
int k)
Returns an array whose contents is a random selection of k elements from the contents of the given data with repetition of a selected index permitted.
The data array is unchanged.
If the data array is null
or if k is less than or equal to zero,
then returns an empty array of integers.
public static int[] selectWithNoRepetition(int[] data,
int k)
Returns an array whose contents is a random selection of k elements from the contents of the given data with no repetition of a selected index.
The data array is unchanged.
If the data array is null
or if k is less than or equal to zero
or if k is greater than the data array size,
then returns an empty array of integers.
public static int[] randomPermutation(int[] data)
Returns an array whose contents is a random permutation of the contents in the data array.
The data array is unchanged.
If the data array is null,
then returns an empty array of integers.
public static int[] repeatData(int[] data,
int k)
Returns an int array that repeats the data in the given array sequentially k times.
If the data array is null or
if k is less than or equal to zero,
then returns an empty array of integers.
If k equals one, then copies the given data.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||