Skip to content

Possibly replace ThreadLocalRandom #1749

Description

@pjfanning

ThreadLocalRandom may not be a great idea if you are using Virtual Threads (#611).

Java 17+ has a new RandomGenerator and we could allow users to choose via config which generator to use.

RandomGenerator random = RandomGenerator.of("L64X128MixRandom")

List of algorithms:
https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/random/package-summary.html#algorithms

We could have a centralised util function to get a generator. Java 8-16 users would get a ThreadLocalRandominstance when this functio was called. Java 17+ users - we could use Reflection or MethodHandles to create a generator based on config.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions