Java 17 gets new implementation for random number generators

Java 17 gets a better implementation for number generators. The development kit contains a proposal for new generators, and an interface in which new generators can be addressed via an API.

This is a proposal for an adaptation of the OpenJDK 17, the Java Development Kit. It states that the makers want a new interface and new implementations for pseudorandom number generators , or PRNGs. Its purpose is to make it easier for developers to build different PRNG algorithms into applications, and to make code clearer and smaller by removing duplications. The makers say that the intention is not to implement many new generators in Java, but to create a framework that makes this easier.

The legacy systems Random, ThreadLocalRandomand SplittableRandomare added to JDK 17 because they are “extensively used in other programming languages.” According to the makers, those three classes have overlapping characteristics for which it is in some cases easier to adjust via an interface.

That new interface is called RandomGenerator. It contains a general API with which existing and new number generators can be added and managed. The makers are also adding four new PRNGs to that interface. These are SplittableRandomGenerator, JumpableRandomGenerator, LeapableRandomGeneratorand ArbitrarilyJumpableRandomGenerator.

The Java Development Kit 17 will not be released until September. It is then a lts release that will receive three years of support. JDK 16 will be released first in March, but that version will only receive support for six months.


Subscribe to our Newsletter