+2003-02-13 Casey Marshall <rsdio@metastatic.org>
+
+ PR libgcj/9271:
+ * java/security/SecureRandom.java (next): Avoid bias in results.
+
2003-02-13 Michael <konqueror@gmx.de>
* gnu/java/nio/FileChannelImpl.java
/* SecureRandom.java --- Secure Random class implmentation
- Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
exception statement from your version. */
package java.security;
+
import java.io.Serializable;
import java.util.Random;
import java.util.Enumeration;
int ret = 0;
for (int i = 0; i < tmp.length; i++)
- ret |= tmp[i] << (8 * i);
+ ret |= (tmp[i] & 0xFF) << (8 * i);
- return ret;
+ long mask = (1L << numBits) - 1;
+ return (int) (ret & mask);
}
/**