From: tromey Date: Thu, 7 Nov 2002 04:38:21 +0000 (+0000) Subject: From svens@it.uu.se. For PR libgcj/8481. X-Git-Tag: upstream/4.9.2~83536 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3241194f8a468d69f4cfc4c6a8d78e5bc2c1736d;p=platform%2Fupstream%2Flinaro-gcc.git From svens@it.uu.se. For PR libgcj/8481. * java/util/Random.java (nextInt(int)): Only use 31 bits. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@58876 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 6a6adf9..9dad879 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,5 +1,10 @@ 2002-11-06 Tom Tromey + From svens@it.uu.se. For PR libgcj/8481. + * java/util/Random.java (nextInt(int)): Only use 31 bits. + +2002-11-06 Tom Tromey + * jni.cc (array_from_valist): Assume that jlong won't be promoted. diff --git a/libjava/java/util/Random.java b/libjava/java/util/Random.java index 500a02d..6e7d8cf 100644 --- a/libjava/java/util/Random.java +++ b/libjava/java/util/Random.java @@ -259,7 +259,7 @@ public int nextInt(int n) int bits, val; do { - bits = next(32); + bits = next(31); val = bits % n; } while(bits - val + (n-1) < 0); @@ -296,7 +296,7 @@ public int nextInt(int n) int bits, val; do { - bits = next(32); + bits = next(31); val = bits % n; } while (bits - val + (n - 1) < 0);