long seed = 314159265; Random rand = new Random(seed); int a = rand.nextInt(); seed = (seed * 0x5DEECE66DL + 0xBL) & ((1L << 48) - 1); int b = (int) (seed >>> (48 - 32));
Why is a not equal to b?
Here is the source code for nextInt() and next():
public int nextInt() { return next(32); } protected synchronized int next(int bits) { seed = (seed * 0x5DEECE66DL + 0xBL) & ((1L << 48) - 1); return (int) (seed >>> (48 - bits)); }