java中用系统时间生成随机数


public class p11 {

	public static void main(String[] args) {
		long r = 0;
		int i = 0;
		while(true) {
			r = System.currentTimeMillis();
			//取模 也就是1----99的随机数
			i = (int)(r  % 100);
			if(0 != i) {
				break;
			}
			
		}
		System.out.println(r);
		System.out.printf("%d \n",i);


	}

}




猜你喜欢

转载自blog.csdn.net/qq_43314793/article/details/90106987
今日推荐