public class Random3 { public static void main(String[] args) { double x; x = 6.0 * Math.random() + 1; // 6*0.0 + 1 = 1.0 x = 6.0 * Math.random() + 1; // 6*1.0 + 1 = 7.0 x = 6.0 * Math.random() + 1; // Range = [1.0 .. 7.0) } }