Module RotationMutator
In: lib/charlie/permutation/permutation.rb
 Rotates the representation of the permutation (i.e. effectively does nothing if it represents a cycle)
  • Example: [1 2 3 4] to [3 4 1 2]

Methods

mutate!  

Public Instance methods

[Source]

    # File lib/charlie/permutation/permutation.rb, line 70
70:   def mutate!
71:    new_start = @genes.rand_index
72:    @genes = @genes[new_start..-1] + @genes[0...new_start]
73:    self
74:   end

[Validate]