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

Ulrich Krause
May 2, 2014 1:52 AM

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.

1 comment(s)Login first to comment...
Alice Smith
(at 05:54 on 27.09.2017)
This is a good solution if the change of the random generator returning a valid number.
<a href=""></a>