生成随机字符串

1.使用uuid生成随机字符串

1 package com.test.springboot.utils;
2 
3 import java.util.UUID;
4 
5 public class Test {
6     public static void main(String[] args) {
7         String random= UUID.randomUUID().toString().replaceAll("-", "").substring(0, 10);
8     }
9 }

执行示例:

 

 http://linuxcoming.com/blog/2019/08/22/java_random_string_generator.html

posted @ 2021-01-07 22:29  悠溜球  阅读(338)  评论(0)    收藏  举报