Class: EvoSynth::Selections::RandomSelection

Inherits:
Object
  • Object
show all
Defined in:
lib/evosynth/operators/selections/random_selection.rb

Instance Method Summary collapse

Instance Method Details

#select(population, select_count = 1) ⇒ Object



30
31
32
33
34
# File 'lib/evosynth/operators/selections/random_selection.rb', line 30

def select(population, select_count = 1)
  selected_population = EvoSynth::Population.new
  select_count.to_i.times { selected_population << population[EvoSynth.rand(population.size)] }
  selected_population
end

#to_sObject



36
37
38
# File 'lib/evosynth/operators/selections/random_selection.rb', line 36

def to_s
  "select random individuals"
end