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

import java.util.Random;

import org.jscience.mathematics.number.Float64;

import org.jenetics.util.RandomRegistry;
import org.jenetics.util.object;

/**
 * @author <a href="mailto:franz.wilhelmstoetter@gmx.at">Franz Wilhelmstötter</a>
 * @since @__new_version__@
 * @version @__new_version__@ &mdash; <em>$Date: 2013-05-21 $</em>
 */
public class Float64Random implements NumberRandom<Float64> {

	private final Random _random;

	public Float64Random(final Random random) {
		_random = object.nonNull(random, "Random");
	}

	public Float64Random() {
		this(RandomRegistry.getRandom());
	}

	@Override
	public Float64 next(final Float64 min, final Float64 max) {
		return next(_random, min, max);
	}

	public static Float64 next(final Random random, final Float64 min, final Float64 max) {
		return Float64.valueOf(
			random.nextDouble()*(max.doubleValue() - min.doubleValue()) +
			min.doubleValue()
		);
	}

}

@@ -877,16 +877,47 @@
 gistry;%0A
+import org.jenetics.util.math;%0A
 import o
@@ -1114,17 +1114,17 @@
 013-05-2
-1
+5
  $%3C/em%3E%0A
@@ -1517,24 +1517,27 @@
 loat64 next(
+%0A%09%09
 final Random
@@ -1544,17 +1544,19 @@
  random,
- 
+%0A%09%09
 final Fl
@@ -1557,33 +1557,35 @@
 nal Float64 min,
- 
+%0A%09%09
 final Float64 ma
@@ -1577,32 +1577,34 @@
 inal Float64 max
+%0A%09
 ) %7B%0A%09%09return Flo
@@ -1620,16 +1620,21 @@
 eOf(%0A%09%09%09
+math.
 random.n
@@ -1647,30 +1647,15 @@
 ble(
-)*(max.doubleValue() -
+random,
  min
@@ -1672,18 +1672,13 @@
 ue()
-) +%0A%09%09%09min
+, max
 .dou
@@ -1687,16 +1687,17 @@
 eValue()
+)
 %0A%09%09);%0A%09%7D

Simplify Float64Random number generation.