fix comment

This commit is contained in:
Looly 2024-01-15 17:12:23 +08:00
parent 9c3dc22a37
commit 5567b4e3fc
2 changed files with 8 additions and 9 deletions

View File

@ -23,11 +23,11 @@ import java.util.Random;
/**
* 提供通用唯一识别码universally unique identifierUUID实现UUID表示一个128位的值<br>
* 此类拷贝自java.util.UUID用于生成不带-的UUID字符串
* <p>
* <h3>Generate UUID 不同版本UUID在线生成和参考<a href="https://idtools.co/uuid/v4">Generate UUID</a></h3>
* <h3>UUID 5 个版本<a href="https://juejin.cn/post/7297225106203689001">UUID 5 version 区别</a></h3>
* <h3>UUID代码实现参考<a href="https://github.com/sake/uuid4j">sake/uuid4j实现</a></h3>
* </p>
* <ul>
* <li>Generate UUID 不同版本UUID在线生成和参考<a href="https://idtools.co/uuid/v4">Generate UUID</a></li>
* <li>UUID 5 个版本<a href="https://juejin.cn/post/7297225106203689001">UUID 5 version 区别</a></li>
* <li>UUID代码实现参考<a href="https://github.com/sake/uuid4j">sake/uuid4j实现</a></li>
* </ul>
* <ul>
* <li>UUIDv1: Structure,形如xxxxxxxx-xxxx-1xxx-yxxx-xxxxxxxxxxxxUUID v1 表示为 32 个字符的十六进制字符串分五组显示并用连字符分隔; <strong>基于时间</strong>同时访问主机的 MAC 地址 generate a time based UUID (V1)</li>
* <li>UUIDv2: Structure,形如xxxxxxxx-xxxx-2xxx-yxxx-xxxxxxxxxxxxUUID v2 的结构与其他 UUID 相同;需要<strong> DCE分布式计算机环境 </strong>生成唯一标识符;由于基于计算主机名有隐私风险未大规模使用</li>
@ -62,7 +62,6 @@ import java.util.Random;
*
* <p>
* variant 字段包含一个表示 UUID 布局的值以上描述的位布局仅在 UUID variant 值为 2表示 Leach-Salz 变体时才有效 *
* <p>
*
* @since 4.1.11
*/
@ -151,7 +150,7 @@ public class UUID implements java.io.Serializable, Comparable<UUID> {
randomBytes[6] &= 0x0f; /* clear version */
randomBytes[6] |= 0x40; /* set to version 4 */
randomBytes[8] &= 0x3f; /* clear variant */
randomBytes[8] |= 0x80; /* set to IETF variant */
randomBytes[8] |= (byte) 0x80; /* set to IETF variant */
return new UUID(randomBytes);
}
@ -173,7 +172,7 @@ public class UUID implements java.io.Serializable, Comparable<UUID> {
md5Bytes[6] &= 0x0f; /* clear version */
md5Bytes[6] |= 0x30; /* set to version 3 */
md5Bytes[8] &= 0x3f; /* clear variant */
md5Bytes[8] |= 0x80; /* set to IETF variant */
md5Bytes[8] |= (byte) 0x80; /* set to IETF variant */
return new UUID(md5Bytes);
}

View File

@ -30,7 +30,7 @@ public class UUIDTest {
final Set<String> set = new ConcurrentHashSet<>(100);
ThreadUtil.concurrencyTest(100, ()-> set.add(UUID.fastUUID().toString()));
Assertions.assertEquals(100, set.size());
Console.log(set);
//Console.log(set);
}