Class: Wallace::Selectors::RandomSelector

Inherits:
Wallace::Selector show all
Defined in:
lib/selectors/random_selector.rb

Instance Method Summary collapse

Methods inherited from Wallace::Selector

#prepare

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