| | |
| | | |
| | | import com.zy.asrs.framework.common.Cools; |
| | | |
| | | import java.security.SecureRandom; |
| | | import java.text.DecimalFormat; |
| | | |
| | | /** |
| | |
| | | throw new RuntimeException("库位解析异常"); |
| | | } |
| | | |
| | | /** |
| | | * 生成随机字符串 |
| | | */ |
| | | public static String generateString(int length) { |
| | | String characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; // 可选的字符集合 |
| | | SecureRandom random = new SecureRandom(); |
| | | StringBuilder sb = new StringBuilder(length); |
| | | for (int i = 0; i < length; i++) { |
| | | int index = random.nextInt(characters.length()); |
| | | char randomChar = characters.charAt(index); |
| | | sb.append(randomChar); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | } |