Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
class Chromosome
attr_accessor :bitstring
def initialize (length, bitstring=nil)
@bitstring ||= rand(2**length+1).to_s(2).rjust(length, '0')
fitness
end
def self.random_chromosomes(length, number)
return Array.new(length) { Chromosome.new(length) }
end
def to_s
@bitstring
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.