📜  Java 随机数生成器 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:18.304000             🧑  作者: Mango

代码示例6
Random random = new Random();
long v1 = random.nextInt();
long v2 = random.nextInt();
for (int i = 0; i < 65536; i++) {
    long seed = v1 * 65536 + i;
    if (((seed * multiplier + addend) & mask) >>> 16) == v2) {
        System.out.println("Seed found: " + seed);
        break;
    }
}