package com.reyun.util;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Random;

/**
 * Created by Administrator on 2017/6/8 0008.
 */
public class MessageUtil {

    /**
     * 产生随机的六位数
     * @return
     */
    public static String getSix(){
        String[] beforeShuffle = new String[] { "0","1","2", "3", "4", "5", "6", "7",
                "8", "9" };
        List list = Arrays.asList(beforeShuffle);

        Collections.shuffle(list);

        StringBuilder sb = new StringBuilder();

        for (int i = 0; i < list.size(); i++) {

            sb.append(list.get(i));

        }

        String afterShuffle = sb.toString();

        String result = afterShuffle.substring(3, 9);
       return result;
    }

    public static void main(String[] args) {
        for(int i=0;i<1000;i++) {
            System.out.println(MessageUtil.getSix());
        }
    }
}
