1. Random Number Generator Example (Integer with Range)
1 2 3 4 5 6 7 | static void testRandom() { Random r = new Random(); r.setSeed(System.currentTimeMillis()); for( int i = 0; i < 10; i++ ) { System.out.println( "Number: " + r.nextInt(100)); } } |
Result:
Number: 8 Number: 28 Number: 48 Number: 25 Number: 1 Number: 85 Number: 83 Number: 24 Number: 41 Number: 62
댓글 없음:
댓글 쓰기