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.

It concerns 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 it easier.

The legacy systems Random, ThreadLocalRandom, and SplittableRandom are added to JDK 17 because they are “frequently used in other programming languages.” According to the makers, those three classes have overlapping characteristics, which in some cases are 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 also add four new PRNGs to that interface. They are SplittableRandomGenerator, JumpableRandomGenerator, LeapableRandomGenerator, and ArbitrarilyJumpableRandomGenerator.

The Java Development Kit 17 will not be released until September. This is an lts release that will receive support for three years. JDK 16 will be released in March, but that version will only receive support for half a year.

Comments
Loading...