net.sourceforge.cilib.util.selection.recipes.RandomSelector Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cilib-library Show documentation
Show all versions of cilib-library Show documentation
A library of composable components enabling simpler Computational Intelligence
The newest version!
/** __ __
* _____ _/ /_/ /_ Computational Intelligence Library (CIlib)
* / ___/ / / / __ \ (c) CIRG @ UP
* / /__/ / / / /_/ / http://cilib.net
* \___/_/_/_/_.___/
*/
package net.sourceforge.cilib.util.selection.recipes;
import net.sourceforge.cilib.util.selection.PartialSelection;
import net.sourceforge.cilib.util.selection.Selection;
import net.sourceforge.cilib.util.selection.arrangement.RandomArrangement;
/**
* Perform a random selection from the provided list of elements.
*
* Random selection is performed by:
*
* - A random element is selected from the provided list.
* - Return the result.
*
* @param
*/
public class RandomSelector implements Selector {
private static final long serialVersionUID = -5099663528040315048L;
@Override
public PartialSelection on(Iterable iterable) {
return (Selection) Selection.copyOf(iterable).orderBy(new RandomArrangement());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy