生成隨機數,沒有固定規則

 

public  String getNum() {
        // 取得一個100000-999999的隨機數
        String s = "";

        int intCount = 0;

        intCount = (new Random()).nextInt(999999);

        if (intCount < 100000) {
            intCount += 100000;
        }

        s = intCount + "";
        return s;
    }

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章