/// <summary> /// Moves an randomly chosen element in the specified <paramref name="permutation"/> array /// to another randomly generated position. /// </summary> /// <param name="random">The random number generator.</param> /// <param name="permutation">The permutation to manipulate.</param> public static void Apply(IRandom random, Permutation permutation) { var cutIndex = random.Next(permutation.Length); var insertIndex = random.Next(permutation.Length); if (cutIndex == insertIndex) { return; } permutation.Move(cutIndex, cutIndex, insertIndex); }
public static void Apply(Permutation permutation, int breakPoint1, int breakPoint2, int insertPoint) { permutation.Move(breakPoint1, breakPoint2, insertPoint); }