代码如下:
public static void main(String[] args) {
String val = ThreadLocalRandom.current().ints(0, 10).distinct().limit(10).mapToObj(i -> i + "").collect(Collectors. joining(","));
System.out.println(val);
}
输出如下:
7,6,0,1,3,5,9,8,2,4