Create random numbers in a range

package de.eknori.common;

public class Randomizer {

	public Randomizer() {

	}

	/***
	 * @param min
	 * @param max
	 * @return
	 */
	public static int generate(int min, int max) {
		return min + (int) (Math.random() * ((max - min) + 1));
	}
}





A simple Randomizer to create random numbers between min and max

Java
Ulrich Krause
May 2, 2014 1:52 AM
Rating
4

All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.



No comments yetLogin first to comment...