Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
public static void main(String[] args) { String uuid = null; while ((uuid = UUID.randomUUID().toString().replace("-", "")).hashCode() != Integer.MIN_VALUE){}; System.out.println("i got one! " + uuid); }
我找不到结果。即使我不知道结果是否存在。帮我。
是的,存在一个。事实上,大约一个随机的 UUID2^32将有一个hashcode等于Integer.MIN_VALUE. 如果您运行测试足够长的时间,您会找到一个。
2^32
hashcode
Integer.MIN_VALUE