private Node selectRandomHandleNode(Session session) throws RepositoryException { HippoNodeIterator documents = findAllHandleNodes(session); Node target = null; if (documents.hasNext()) { int index = random.nextInt((int)documents.getTotalSize()); if (index > 0) { documents.skip(index); } if (documents.hasNext()) { target = documents.nextNode(); } } return target; }
while (hippoNodeIterator.hasNext() && documentCount < amount) { final Node node = hippoNodeIterator.nextNode(); Node canonical = ((HippoNode) node).getCanonicalNode();