| 8 | |
| 9 | public class RandomBounds { |
| 10 | public static void main(String[] args) { |
| 11 | new TimedAbort(3); |
| 12 | switch(args.length == 0 ? "" : args[0]) { |
| 13 | case "lower": |
| 14 | while(Math.random() != 0.0) |
| 15 | ; // Keep trying |
| 16 | System.out.println("Produced 0.0!"); |
| 17 | break; |
| 18 | case "upper": |
| 19 | while(Math.random() != 1.0) |
| 20 | ; // Keep trying |
| 21 | System.out.println("Produced 1.0!"); |
| 22 | break; |
| 23 | default: |
| 24 | System.out.println("Usage:"); |
| 25 | System.out.println("\tRandomBounds lower"); |
| 26 | System.out.println("\tRandomBounds upper"); |
| 27 | System.exit(1); |
| 28 | } |
| 29 | } |
| 30 | } |