java生成0~9个9个不相等的整数
生活随笔
收集整理的這篇文章主要介紹了
java生成0~9个9个不相等的整数
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
HashSet<Integer> hs=new HashSet<Integer>();Integer i=0;while (i<9){int s=(int) Math.ceil((Math.random()*9));hs.add(s);i=hs.size();}for(Integer s:hs) {System.out.println(s);}
轉(zhuǎn)載于:https://www.cnblogs.com/Web-spring/p/11109591.html
總結(jié)
以上是生活随笔為你收集整理的java生成0~9个9个不相等的整数的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: svnserve.conf - snvs
- 下一篇: 基于【 centos7】一 || 安装E