/*
 * Java Genetic Algorithm Library (@__identifier__@).
 * Copyright (c) @__year__@ Franz Wilhelmstötter
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Author:
 *    Franz Wilhelmstötter (franz.wilhelmstoetter@gmx.at)
 */
package org.jenetics;

import org.jenetics.util.MSeq;

/**
 * @author <a href="mailto:franz.wilhelmstoetter@gmx.at">Franz Wilhelmstötter</a>
 * @version !__version__!
 * @since !__version__!
 */
public class UniformCrossover<
	G extends Gene<?, G>,
	C extends Comparable<? super C>
>
	extends Crossover<G, C>
{
	public UniformCrossover(final double probability) {
		super(probability);
	}

	public UniformCrossover() {
		this(DEFAULT_ALTER_PROBABILITY);
	}

	@Override
	protected int crossover(final MSeq<G> that, final MSeq<G> other) {
		return 0;
	}

}

@@ -768,30 +768,163 @@
 ort 
-org.jenetics.util.MSeq
+static java.lang.Math.min;%0Aimport static org.jenetics.internal.math.random.indexes;%0A%0Aimport org.jenetics.util.MSeq;%0Aimport org.jenetics.util.RandomRegistry
 ;%0A%0A/
@@ -1178,16 +1178,17 @@
 G, C%3E%0A%7B%0A
+%0A
 %09public 
@@ -1411,16 +1411,382 @@
 %7B%0A%09%09
-return 0
+final int length = min(that.length(), other.length());%0A%09%09return (int)indexes(RandomRegistry.getRandom(), length, _probability)%0A%09%09%09.peek(i -%3E swap(i, that, other))%0A%09%09%09.count();%0A%09%7D%0A%0A%09private static %3CT%3E void swap(%0A%09%09final int index,%0A%09%09final MSeq%3CT%3E that,%0A%09%09final MSeq%3CT%3E other%0A%09) %7B%0A%09%09final T temp = that.get(index);%0A%09%09that.set(index, other.get(index));%0A%09%09other.set(index, temp)
 ;%0A%09%7D

Implement UniformCrossover alterer.