# orderCrossover

> **orderCrossover**<`T`>(`first`, `second`, `cut`): readonly \[readonly `T`\[], readonly `T`\[]]

Defined in: [packages/evolution/src/permutation.ts:35](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/evolution/src/permutation.ts#L35)

Cross two permutations with an inclusive order-crossover cut.

Both parents must have equal length and contain the same unique values under `Set` SameValueZero equality. Each child keeps one parent’s cut segment and fills the other positions in the opposite parent’s cyclic order. Runs in O(n) expected time and O(n) auxiliary space, returns new readonly arrays, and never mutates either parent.

## Type Parameters

### T

`T`

## Parameters

### first

readonly `T`\[]

### second

readonly `T`\[]

### cut

readonly \[`number`, `number`]

## Returns

readonly \[readonly `T`\[], readonly `T`\[]]

## Throws

With code `INVALID_PERMUTATION` when a parent is not an array, `DUPLICATE_ELEMENT` when either parent repeats a value, `UNEQUAL_PARENT_DOMAIN` when parent domains differ, or `INVALID_CUT` when the cut is not an ascending safe-integer pair inside both parents.
