package com.copy.trade.util;

import java.util.Random;

public class RandomUtil {

    private static Integer min = 1000;
    private static Integer max = 100000;

    public static int nonce(){
        return  (int) (Math.random() * (max - min) + min);
    }

    /**
     * 生成两个整数之间的随机数
     * @param min 最小值
     * @param max 最大值
     * @return
     */
    public static int random(int min,int max){
        Random random = new Random();
        return random.nextInt(max)%(max-min+1) + min;
    }

    public static String orderNo(String prefix){
        long l = System.nanoTime();
        int random = random(1, 99);
        StringBuilder sb = new StringBuilder();
        if(prefix != null){
            sb.append(prefix);
        }
        sb.append(l);
        sb.append(random);
        return sb.toString();
    }
}
