给定0到4的随机数的方法,产生0到6的随机数的方法

来源:互联网 发布:php自动加载机制 编辑:程序博客网 时间:2024/04/30 16:02
public class Frequency {
public static int rand7()
{
while(true)
{
int num=5*rand5()+rand5();
if(num<21)
{
return num % 7;
}
}


}
}
0 0