diff options
author | Tom Tromey <tromey@redhat.com> | 2002-11-07 04:22:44 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2002-11-07 04:22:44 +0000 |
commit | 0b3a2fd392edd5e25d40b47067cae5c5e0ff983c (patch) | |
tree | 6a806c52cca5f5a89a046a279bb3b26fcf41a496 /java/util/Random.java | |
parent | 0aaa1ba2a924f0775f2edcec185a1f11a5dd1b2e (diff) | |
download | classpath-0b3a2fd392edd5e25d40b47067cae5c5e0ff983c.tar.gz |
From svens@it.uu.se:
* java/util/Random.java (nextInt(int)): Only use 31 bits.
Diffstat (limited to 'java/util/Random.java')
-rw-r--r-- | java/util/Random.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/java/util/Random.java b/java/util/Random.java index 500a02d37..6e7d8cf24 100644 --- a/java/util/Random.java +++ b/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); |