maven
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 --> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.9</version> </dependency>
org.apache.commons.lang3.RandomUtils
概述
Utility library that supplements the standard {@link Random} class.
工具库 支持 标准的Random;
Caveat: Instances of {@link Random} are not cryptographically secure.
警告:Random实例 在加密上是不安全的;
Please note that the Apache Commons project provides a component dedicated to pseudo-random number generation,
namely <a href="https://commons.apache.org/rng">Commons RNG</a>, that may be a better choice for applications with more stringent requirements (performance and/or correctness).
Apache Commons project 提供了一个专门用于 生成伪随机数的组件(Commons RNG,可能是一个更好的选择 对于更高要求的应用);
org.apache.commons.lang3.RandomStringUtils
概述
Operations for random {@code String}s.
生成 随机String;
Currently <em>private high surrogate</em> characters are ignored.
These are Unicode characters that fall between the values 56192 (db80) and 56319 (dbff) as we don't know how to handle them.
High and low surrogates are correctly dealt with - that is if a high surrogate is randomly chosen, 55296 (d800) to 56191 (db7f) then it is followed by a low surrogate.
If a low surrogate is chosen, 56320 (dc00) to 57343 (dfff) then it is placed after a randomly chosen high surrogate.private high surrogate字符被忽略,这些是介于 56192和56319之间的Unicode字符,不知道如何处理它们;
RandomStringUtils is intended for simple use cases.
For more advanced use cases consider using commons-text <a href="https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/RandomStringGenerator.html"> RandomStringGenerator</a> instead.
RandomStringUtils适用于 简单的用例; 对于 更高级的用例,请使用RandomStringGenerator;
Caveat: Instances of {@link Random}, upon which the implementation of this class relies, are not cryptographically secure.
警告:Random实例,是 加密不安全的;
ThreadSafe
线程安全;
标签:surrogate,Random,commons,Commons,high,lang3 From: https://www.cnblogs.com/anpeiyong/p/18019398