/*
18、用Math.random生成1,2,3,4,5,6,7,8,9,10
*/
import java.util.*;
class Test18
{
public static void main(String[] args)
{
TreeSet<Integer> ts = new TreeSet<Integer>();
while(ts.size()<10)
{
int a= (int)(Math.random()*10+1);
ts.add(a);
}
System.out.println(ts);
}
}
|
|