Here is my codejava - Generate a random even number inside a range? Newest. java - FileNotFoundException in hive UDF. 11 Replies Latest reply on Dec 14, 2006 2:43 PM by 807599. how do i generate random number within a range.code: import java.util. public class randomtest public static void main(String args) double a a(Math. random())21 System.out.println(a) 1.1 Code snippet. For getRandomNumberInRange(5, 10), this will generates a random integer between 5 (inclusive) and 10 (inclusive).1.3 Full examples to generate 10 random integers in a range between 5 (inclusive) and 10 (inclusive).Tags : java8 random number. Generate non repeating random number within range in Java.