apache / apache/pekko

Possibly replace ThreadLocalRandom

Open
#1,749 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Scala
Stars
1.6k
Forks
211
Avg merge
1d 6h
Merged PRs (30d)
89

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.