RFR: 8372134: ThreadLocalRandom no longer overrides nextGaussian [v5]

Alan Bateman alanb at openjdk.org
Tue Dec 2 08:29:03 UTC 2025


On Tue, 2 Dec 2025 00:04:17 GMT, Joe Darcy <darcy at openjdk.org> wrote:

> Catching up after being OOTO, I was trying to see if there was a minor spec change here that should have a quick retroactive CSR.

In the JDK 25 API docs, TLR doesn't override nextGaussian but does link to both Random.nextGaussian and RandomGenerator.nextGaussian. Random.nextGaussian's implSpec is the polar method. RandomGenerator.nextGaussian's implSpec is the McFarland  ziggurat algorithm. 

With the update. TLR override's nextGaussian will an implNote that it uses the McFarland  ziggurat algorithm by way of invoking RandomGenerator.nextGaussian. So it is using a different algorithm to before. I don't expect TLR.nextGaussian is used much and hasn't been possible to tell from the API docs since JDK 17 (and the changes in JEP 356) which algorithm it used.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/28483#issuecomment-3600810096


More information about the core-libs-dev mailing list