Class: Wallace::Selectors::RandomSelector
- Inherits:
-
Wallace::Selector
- Object
- Wallace::Selector
- Wallace::Selectors::RandomSelector
- Defined in:
- lib/selectors/random_selector.rb
Instance Method Summary collapse
-
#produce(rng, candidates) ⇒ Object
Selects an individual at random from the list of candidates.
Methods inherited from Wallace::Selector
Instance Method Details
#produce(rng, candidates) ⇒ Object
Selects an individual at random from the list of candidates.
Arguments
-
rng, random number generator to use to select index of individual.
-
candidates, the list of candidates to select from.
10 11 12 |
# File 'lib/selectors/random_selector.rb', line 10 def produce(rng, candidates) candidates.sample(random: rng) end |