All Downloads are FREE. Search and download functionalities are using the official Maven repository.

aima.core.util.JavaRandomizer Maven / Gradle / Ivy

Go to download

AIMA-Java Core Algorithms from the book Artificial Intelligence a Modern Approach 3rd Ed.

The newest version!
package aima.core.util;

import java.util.Random;

/**
 * Implementation of the Randomizer Interface using Java's java.util.Random
 * class.
 * 
 * @author Ravi Mohan
 * 
 */
public class JavaRandomizer implements Randomizer {
	private static Random _r = new Random();
	private Random r = null;

	public JavaRandomizer() {
		this(_r);
	}

	public JavaRandomizer(Random r) {
		this.r = r;
	}

	//
	// START-Randomizer
	@Override
	public double nextDouble() {
		return r.nextDouble();
	}

	// END-Randomizer
	//
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy