float requiredScore) {
int length = size();
if (length > 0) {
int j = new Random().nextInt(length);
Route route = get(j);
if (route.score(request, response) >= requiredScore) {
return route;
}
boolean loopedAround = false;
do {
if ((j == length) && (loopedAround == false)) {
j = 0;
loopedAround = true;
}
route = get(j++);
if (route.score(request, response) >= requiredScore) {
return route;
}
} while ((j < length) || !loopedAround);
}