/*
 * 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.jenetix.random;

import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.LongStream;

import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import org.jenetics.util.TestData;

/**
 * @author <a href="mailto:franz.wilhelmstoetter@gmx.at">Franz Wilhelmstötter</a>
 * @version <em>$Date: 2014-07-17 $</em>
 */
public class MT19937_32RandomCompatibilityTest {

	private final static String TEST_RESOURCE =
		"/org/jenetix/random/MT19937_32Random.dat/%d";

	@Test(dataProvider = "seeds")
	public void constructorSeed(final long seed) {
		final Random random = new MT19937_32Random(seed);

		final String resource = String.format(TEST_RESOURCE, seed);
		for (final String[] value : new TestData(resource)) {
			final int expected = Integer.parseInt(value[0]);
			Assert.assertEquals(random.nextInt(), expected);
		}
	}

	@Test(dataProvider = "seeds")
	public void setSeedSeed(final long seed) {
		final Random random = new MT19937_32Random(1234);
		random.setSeed(seed);

		final String resource = String.format(TEST_RESOURCE, seed);
		for (final String[] value : new TestData(resource)) {
			final int expected = Integer.parseInt(value[0]);
			Assert.assertEquals(random.nextInt(), expected);
		}
	}

	@DataProvider(name = "seeds")
	public Object[][] seeds() {
		final List<Long[]> seeds = LongStream.range(0, 100)
			.mapToObj(i -> new Long[]{i*32344})
			.collect(Collectors.toList());

		return seeds.toArray(new Object[0][]);
	}

}

@@ -767,31 +767,8 @@
 m;%0A%0A
-import java.util.List;%0A
 impo
@@ -828,43 +828,8 @@
 rs;%0A
-import java.util.stream.IntStream;%0A
 impo
@@ -2090,34 +2090,14 @@
 %7B%0A%09%09
-final List%3CLong%5B%5D%3E seeds =
+return
  Lon
@@ -2193,25 +2193,12 @@
 t())
-;%0A
 %0A%09%09
-return seeds
+%09
 .toA

Add 'MT19937_32Random' (Mersenne Twister) class.