/*
??????@param num specified the count of integer number array
??????@param max specified the the max of array
*/
public int [] getRandom(int num,int max)
?{
??int onlyInt[] = new int[num],tmpInt=0,flag=0;
??for(int i=0;i<num;i++)
??{
???? tmpInt =? (int)(Math.random()*max+1);
???? if(i==0)
???? onlyInt[0] = tmpInt;
???? else
???? {
????? ?for(int j=0;j<i;j++)
?????? {
?????? ?if(tmpInt==onlyInt[j])
??????? {
??????? ?i--;//如果有重復,返回原來的一步循環
??????? ?flag=1;
??????? ?break;
?????? ?}
?????? ?else flag = 0;
?????? }
???}
???if(flag==0)
???? onlyInt[i]=tmpInt;
?? }
??return onlyInt;?
?}
??????@param num specified the count of integer number array
??????@param max specified the the max of array
*/
public int [] getRandom(int num,int max)
?{
??int onlyInt[] = new int[num],tmpInt=0,flag=0;
??for(int i=0;i<num;i++)
??{
???? tmpInt =? (int)(Math.random()*max+1);
???? if(i==0)
???? onlyInt[0] = tmpInt;
???? else
???? {
????? ?for(int j=0;j<i;j++)
?????? {
?????? ?if(tmpInt==onlyInt[j])
??????? {
??????? ?i--;//如果有重復,返回原來的一步循環
??????? ?flag=1;
??????? ?break;
?????? ?}
?????? ?else flag = 0;
?????? }
???}
???if(flag==0)
???? onlyInt[i]=tmpInt;
?? }
??return onlyInt;?
?}