- 讲师:刘萍萍 / 谢楠
- 课时:160h
- 价格 4580 元
特色双名师解密新课程高频考点,送国家电网教材讲义,助力一次通关
配套通关班送国网在线题库一套
Java代码 public class RandomUtil {
2.
3. private static Random random = new Random();
4.
5.
6. public static String getRandomNumber(String[] range,int rangeLength,int length){
7. StringBuffer sb = new StringBuffer();
8. for(int i=0;i
9. sb.append(String.valueOf(range[random.nextInt(rangeLength)]));
10. }
11. return sb.toString();
12. }
13. public static void main(String[] args) {
14. String[] range = {"0","1","2","3","4","5","6","7","8","9"};
15. System.out.println(getRandomNumber(range, 10, 8));
16.
17. }
18.}
运行结果:
91373770
责编:罗莉
下一篇:排列组合算法的java实现
课程专业名称 |
讲师 |
课时 |
查看课程 |
---|
课程专业名称 |
讲师 |
课时 |
查看课程 |
---|
点击加载更多评论>>