|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.ObjectUtility
final class Utility
| Method Summary | |
|---|---|
(package private) static long |
gcd(long a,
long b)
Calculates the greatest common divisor of two given integers using Euclid's algorithm. |
(package private) static int[] |
generatePermutation(int n)
Generates a permutation of integers 1 to n. |
(package private) static long |
lcm(long a,
long b)
Calculates the least common multiple of two given integers using formula lcm(a,b)=(a*b)/gcd(a,b). |
(package private) static boolean |
randBool()
Generates a random boolean. |
(package private) static int |
randInt(int min,
int max)
Generates a random number from interval (inclusive), while the numbers closer to the center of the interval are more probable. |
(package private) static int |
randIntUniform(int min,
int max)
Generates a random number from interval (inclusive). |
(package private) static int[] |
randNTuple(int min,
int max,
int n)
Generates an n-tuple of random numbers from interval (inclusive), while the numbers closer to the center of the interval are more probable. |
(package private) static int[] |
randNTupleUniform(int min,
int max,
int n)
Generates an n-tuple of random numbers from interval (inclusive). |
(package private) static void |
texOut(String str)
Writes to tex file containing results. |
(package private) static void |
textOut(String str)
Writes to text file containing results. |
| Methods inherited from class |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
static long gcd(long a,
long b)
a - the first numberb - the other number
static int[] generatePermutation(int n)
n.
n - number of integers to permutate
static long lcm(long a,
long b)
a - the first numberb - the other number
static boolean randBool()
static int randInt(int min,
int max)
min - minimum valuemax - maximum value (must be at least min; if min is greater than max, we switch the values)
static int randIntUniform(int min,
int max)
min - minimum valuemax - maximum value (must be at least min; if min is greater than max, we switch the values)
static int[] randNTuple(int min,
int max,
int n)
min - minimum valuemax - maximum value (must be greater than min; if min is greater than max, we switch the values)
static int[] randNTupleUniform(int min,
int max,
int n)
min - minimum valuemax - maximum value (must be greater than min; if min is greater than max, we switch the values)static void texOut(String str)
str - string to be writtenstatic void textOut(String str)
str - string to be written
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||