java 产生随机数

package edu.sjtu.erplab.io;



import java.util.Random;



public class RandomTest {

    public static void main(String[] args) {

        int max=20;

        int min=10;

        Random random = new Random();



        int s = random.nextInt(max)%(max-min+1) + min;

        System.out.println(s);

    }

}
复制代码

你可能感兴趣的:(java)