java中生成随机数的方法例子

@Test
	public void test() {
		Random r = new Random(System.currentTimeMillis());
	    for(int i=0;i<10;i++){
		System.out.println("随机数:"+Math.abs(r.nextInt()%40)+"::::"+(int)(Math.random()*40));
	    }
	}

猜你喜欢

转载自sky-xin.iteye.com/blog/2280754