dimanche 31 juillet 2022

Seeded RandomGenerators in Java 17

Java 17 has introduced a new RandomGeneratorFactory class for instantiating random number generators. The create(long) method is described as

Create an instance of RandomGenerator based on algorithm chosen providing a starting long seed. If long seed is not supported by an algorithm then the no argument form of create is used.

However there doesn't seem to be a method of RandomGeneratorFactory that can be used to determine if a long seed is supported. How is it possible to use the new API to obtain an instance of RandomGenerator that is guaranteed to be created using a supplied long seed?




Aucun commentaire:

Enregistrer un commentaire