随机手机号
2022/7/25 6:52:57
本文主要是介绍随机手机号,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
方法一:
//定义手机号前3位 String[] FirstThreeNumber = {"134","135","136","137","138","139","147","150","152","157","158","159","172","178","182","183","184","187","188","198","130","131","132","145","155","156","166","171","175","176","185","186","166","133","149","153","173","177","180","181","189","199"}; //随机获取前三位手机号的index int n= (int)(Math.random() * FirstThreeNumber.length); //int n= (int)(Math.random()*(3-1)+1); //设置一个1到3的变量 //int n= (int)(Math.random()*5); //设置一个0到4的变量 //获取手机前三位 String yy = FirstThreeNumber[n]; //循环获取手机号后8位 for(int i = 0; i < 8; i++){ int x = (int)(Math.random() * 9); //设置一个0到8的变量 yy = yy + x; }; vars.put("com_phone", yy);
方法二:
//现在设置一个用户初始变量手机号,然后在这里获取 String aa=vars.get("beginPhone"); //log.info("获取手机号: "+aa); Long phone2 =Long.valueOf(aa); //每次加一 phone2 = phone2+1; String newPhone=String.valueOf(phone2); //log.info(newPhone); vars.put("beginPhone",newPhone);
这篇关于随机手机号的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-13怎么通过 JavaScript 或其他编程语言来实现监听屏幕高度变化功能?-icode9专业技术文章分享
- 2024-11-12聊聊我们那些年用过的表达式引擎组件
- 2024-11-12让项目数据更有说服力:五款必备数据可视化管理工具推荐
- 2024-11-12人到一定年纪,要学会远离多巴胺
- 2024-11-12解读:精益生产管理的目的是什么?如何操作?
- 2024-11-12Sku预研作业
- 2024-11-12文心一言API密钥:分步申请指南
- 2024-11-12初学者指南:轻松掌握后台交互
- 2024-11-12从零开始学习:封装基础知识详解
- 2024-11-12JSON对象入门教程:轻松掌握基础用法