/*
 * Java Genetic Algorithm Library (@__identifier__@).
 * Copyright (c) @__year__@ Franz Wilhelmstötter
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * Author:
 *     Franz Wilhelmstötter (franz.wilhelmstoetter@gmx.at)
 *
 */
package org.jenetics.util;


/**
 * Some helper method concerning random number generation.
 *
 * @author <a href="mailto:franz.wilhelmstoetter@gmx.at">Franz Wilhelmstötter</a>
 * @since 1.1
 * @version 1.1 &mdash; <em>$Date: 2012-12-05 $</em>
 */
class random {

	private random() {
		throw new AssertionError("Don't create an 'random' instance.");
	}

	static long seed(final long seed) {
		long s = seed^nanoTimeSeed();
		s ^= s << 21;
		s ^= s >>> 35;
		s ^= s << 4;
		return s;
	}

	/**
	 * Calculating a 64 bit seed value which can be used for initializing PRNGs.
	 *
	 * @return the random seed value.
	 */
	static long seed() {
		long seed = nanoTimeSeed();
		seed ^= seed(seed);
		seed ^= seed(seed);
		seed ^= seed(seed);
		return seed;
	}

	private static long nanoTimeSeed() {
		return
		((System.nanoTime() & 255) << 56) |
		((System.nanoTime() & 255) << 48) |
		((System.nanoTime() & 255) << 40) |
		((System.nanoTime() & 255) << 32) |
		((System.nanoTime() & 255) << 24) |
		((System.nanoTime() & 255) << 16) |
		((System.nanoTime() & 255) <<  8) |
		((System.nanoTime() & 255) <<  0);
	}

}




@@ -1273,16 +1273,265 @@
 %22);%0A%09%7D%0A%0A
+%09static byte%5B%5D seed(final byte%5B%5D seed) %7B%0A%09%09for (int i = 0, len = seed.length; i %3C len;) %7B%0A%09%09%09int n = Math.min(len - i, Long.SIZE/Byte.SIZE);%0A%0A%09%09%09for (long x = seed(); n-- %3E 0; x %3E%3E= Byte.SIZE) %7B%0A%09%09%09%09seed%5Bi++%5D = (byte)x;%0A%09%09%09%7D%0A%09%09%7D%0A%0A%09%09return seed;%0A%09%7D%0A%0A
 %09static 
@@ -2040,10 +2040,10 @@
  %3C%3C 
-48
+ 0
 ) %7C%0A
@@ -2078,10 +2078,10 @@
  %3C%3C 
-40
+32
 ) %7C%0A
@@ -2104,34 +2104,34 @@
 ime() & 255) %3C%3C 
-32
+16
 ) %7C%0A%09%09((System.n
@@ -2180,34 +2180,34 @@
 ime() & 255) %3C%3C 
-16
+40
 ) %7C%0A%09%09((System.n
@@ -2264,18 +2264,18 @@
 255) %3C%3C 
- 0
+48
 );%0A%09%7D%0A%0A%7D

Add random.seed(byte[]) method.