补贴
等我写完回答答案的时候 贴主已经结账了 郁闷
不过还是贴出我的答案 交流交流
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Vector;
import java.util.Random;
/*
* 随机输出类
* */
public class RandomArray {
private Object[] obj;
public RandomArray(Object[] obj) {
if (obj == null)
throw new NullPointerException();
this.obj = obj;
}
public Enumeration GetEnumeration() {
Vector retval = new Vector();
Random rand = new Random(System.currentTimeMillis());
int length = this.obj.length;
int[] isHave = new int[length];// 记录是否被随机抽取过
int value;
for (int i = 0; i < length; i++) {
do {
value = rand.nextInt(length);
} while (isHave[value] != 0);
isHave[value] = 1;
retval.add(this.obj[value]);
}
return retval.elements();
}
}
不过还是贴出我的答案 交流交流
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Vector;
import java.util.Random;
/*
* 随机输出类
* */
public class RandomArray {
private Object[] obj;
public RandomArray(Object[] obj) {
if (obj == null)
throw new NullPointerException();
this.obj = obj;
}
public Enumeration GetEnumeration() {
Vector retval = new Vector();
Random rand = new Random(System.currentTimeMillis());
int length = this.obj.length;
int[] isHave = new int[length];// 记录是否被随机抽取过
int value;
for (int i = 0; i < length; i++) {
do {
value = rand.nextInt(length);
} while (isHave[value] != 0);
isHave[value] = 1;
retval.add(this.obj[value]);
}
return retval.elements();
}
}
...全文
相关推荐
VB科研项目管理系统设计(源代码+系统).zip
VB科研项目管理系统设计(源代码+系统).zip
VB科研项目管理系统设计(源代码+系统)【VB】.zip
VB科研项目管理系统设计(源代码+系统)【VB】 VB科研项目管理系统设计(源代码+系统)【VB】 VB科研项目管理系统设计(源代码+系统)【VB】 VB科研项目管理系统设计(源代码+系统)【VB】 VB科研项目管理系统设计(源代码+系统)【VB】
基于VB实现的科研项目管理系统设计(源代码+系统).zip
【作品名称】:基于VB实现的科研项目管理系统设计(源代码+系统) 【适用人群】:适用于希望学习不同技术领域的小白或进阶学习者。可作为毕设项目、课程设计、大作业、工程实训或初期项目立项。
VB毕业设计——VB科研项目管理系统设计(源代码+系统).zip
VB毕业设计
VB毕业设计—VB科研项目管理系统设计(源代码+系统).zip
VB毕业设计—VB科研项目管理系统设计(源代码+系统).zip


Java SE

