랜덤 클래스와 랜덤 함수
| 
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 | 
// Math.random() 
// static, data type : double  
double ran1 = Math.random(); 
// double -> int    
int temp = (int)(ran1*10); 
temp = temp%100; // result : 0~99 
// Random Class 
Random ran2 = new Random(); 
ran2.nextInt(100); // result : 0~99 | cs | 
댓글
댓글 쓰기