Merging MK branch revs. 243-249. Population sorting by fitness index, new package operators.paramcontrol for adaptive parameters, as well as minor stuff.

This commit is contained in:
Marcel Kronfeld
2009-03-17 17:26:06 +00:00
parent ac92a3a119
commit abafb57679
18 changed files with 761 additions and 130 deletions

View File

@@ -75,7 +75,15 @@ public class RNG extends Random {
* @return int
*/
public static int randomInt(int lo,int hi) {
if (hi<lo) {
System.err.println("Invalid boundary values! Returning zero.");
return -1;
}
int result = (Math.abs(random.nextInt())%(hi-lo+1))+lo;
if ((result < lo) || (result > hi)) {
System.err.println("Error in RNG.randomInt!");
result = Math.abs(random.nextInt()%(hi-lo+1))+lo;
}
return result;
}