/* * Random number from the lower bound to the upper bound * Example: from 13 to 27 inclusive */ package randomdist; import javax.swing.JOptionPane; public class RandomDist { public static void main(String[] args) { int lower = Integer.parseInt(JOptionPane.showInputDialog(null, "Enter the lower bound")); int upper = Integer.parseInt(JOptionPane.showInputDialog(null, "Enter the upper bound"))+ 1; for(int i = 0 ; i < 20; i++) { int myRandom = (int)((Math.random() * (lower - upper) + upper)); System.out.println("The number is " + myRandom); } } }