pal.math
Class MathUtils
java.lang.Object
|
+--pal.math.MathUtils
- public class MathUtils
- extends java.lang.Object
Handy utility functions which have some Mathematical relavance.
Field Summary |
static MersenneTwisterFast |
random
A random number generator that is initialized with the clock when this
class is loaded into the JVM. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
random
public static MersenneTwisterFast random
- A random number generator that is initialized with the clock when this
class is loaded into the JVM. Use this for all random numbers.
MathUtils
public MathUtils()
getNormalized
public static final double[] getNormalized(double[] array)
- Returns:
- a new double array where all the values sum to 1.
Relative ratios are preserved.
getTotal
public static final double getTotal(double[] array,
int start,
int end)
- Parameters:
end
- the index of the element after the last one to be included- Returns:
- the total of a the values in a range of an array
getTotal
public static final double getTotal(double[] array)
- Returns:
- the total of the values in an array
getRandomArguments
public static final double[] getRandomArguments(MultivariateFunction mf)
- Returns:
- a set of valid, but randomly generated, arguments for a particular MultivariateFunction