Java-练习方法之模拟摇号抽奖
2024-09-21 11:39:23
3.采用多种算法,模拟摇奖:从1-36中随机抽出8个不重复的数字
int[] shuzu=new int[8];
Random ran=new Random();
for(int i=0;i<shuzu.length;i++)
{
shuzu[i]=ran.nextInt(36);
for(int j=0;j<i;j++)
{
if(shuzu[i]==shuzu[j])
{
i--;
}
} }
for(int i=0;i<shuzu.length;i++)
{System.out.println(shuzu[i]);}
最新文章
- [python]set集合学习
- ifconfig: command not found 如何解决?
- ABP理论学习之实体类
- js代码生成form,解决mvc的url参数过长问题
- Linux CentOS6.8下解压安装mysql-5.7.14完整介绍
- Linux踢出其他正在SSH登陆用户
- hdu 2583 permutation
- POJ1201 Intervals(差分约束系统)
- 使用pch预编译文件
- linux源代码阅读笔记 linux文件系统(转)
- Celery Flower监控,完美搞定
- Springmvc整合mybatis
- find the safest road--hdu1596
- ORA-20000: ORU-10027: buffer overflow, limit of 10000 bytes
- Get RSA public key ASN.1 encode from a certificate in DER format
- JavaScript八张思维导图—编程实践
- [ 10.4 ]CF每日一题系列—— 486C
- If you did this already, delete the swap file ";.git/.MERGE_MSG.swp";
- What is SolrCloud? (And how does it compare to master-slave?)
- ASP.NET MVC 习惯