Here you can find the source of getPositiveNumber(int maximum)
Parameter | Description |
---|---|
maximum | the maximum of the number. |
public static int getPositiveNumber(int maximum)
//package com.java2s; import java.util.Random; public class Main { private static final Random RANDOM = new Random(); /**/* w ww . j a v a 2 s . c o m*/ * Gets a random positive number with specified length. * * @param maximum the maximum of the number. * @return random number with specified maximum. */ public static int getPositiveNumber(int maximum) { return RANDOM.nextInt(maximum) + 1; } }