int N = 10, M =100; int A = M - N; double B = Math.random() * A; //Math.random()是取得0到1的double小数 int c = (int) B + N;