8294509: The sign extension bug applies to 'public static int[] convertSeedBytesToInts(byte[] seed, int n, int z)' in RandomSupport

Reviewed-by: shade
This commit is contained in:
Raffaello Giulietti 2022-10-04 10:25:11 +00:00
parent f03934e270
commit 5a9cd33632
2 changed files with 41 additions and 2 deletions

View file

@ -312,7 +312,7 @@ public class RandomSupport {
final int m = Math.min(seed.length, n << 2);
// Distribute seed bytes into the words to be formed.
for (int j = 0; j < m; j++) {
result[j>>2] = (result[j>>2] << 8) | seed[j];
result[j>>2] = (result[j>>2] << 8) | (seed[j] & 0xFF);
}
// If there aren't enough seed bytes for all the words we need,
// use a SplitMix-style PRNG to fill in the rest.