Java实现随机生成车牌号

String[] citys = {"津","京","宁"};
String sectionNamePre = "断面";			
			while (true) {
				String sectionName = sectionNamePre + (new Random().nextInt(2000));	//断面:随机0-1999
				String city = citys[(new Random().nextInt(3))];  //随机取津、京、宁
				StringBuffer plateNumStr = new StringBuffer(city);//下面开始:拼接车牌号,并随机产生0到9的6位车牌号
				plateNumStr.append(new Random().nextInt(10))
								.append(new Random().nextInt(10))
									.append(new Random().nextInt(10))
										.append(new Random().nextInt(10))
											.append(new Random().nextInt(10))
												.append(new Random().nextInt(10));

  

原文地址:https://www.cnblogs.com/Donnnnnn/p/7605320.html