Changes from MK branch rev 190-195, mainly cosmetics, some more enums, DE may do range checking, IPOP-CMA-ES works better from Matlab.

This commit is contained in:
Marcel Kronfeld
2008-09-11 13:27:53 +00:00
parent 49911cdcfd
commit 1782c0a4a7
23 changed files with 669 additions and 256 deletions

View File

@@ -307,5 +307,37 @@ public class RNG extends Random {
Mathematics.normVect(result, result);
return result;
}
/**
* Create a uniform random double vector within the given bounds (inclusive) in every dimension.
*
* @param n
* @param lower
* @param upper
* @return
*/
public static double[] randomVector(int n, double lower, double upper) {
double[] result = new double[n];
for (int i = 0; i < result.length; i++) {
result[i] = RNG.randomDouble(lower, upper);
}
return result;
}
/**
* Create a uniform random integer vector within the given bounds (inclusive) in every dimension.
*
* @param n
* @param lower
* @param upper
* @return
*/
public static int[] randomVector(int n, int lower, int upper) {
int[] result = new int[n];
for (int i = 0; i < result.length; i++) {
result[i] = RNG.randomInt(lower, upper);
}
return result;
}
}