The goal of this project was to create an atomic (thread-safe) Java version of the Xoroshiro128+ random number generator (RNG). The initial Java port was created by Tommy Ettinger for his SquidPony/SquidLib project, and I've since went on to make it atomic and thread-safe for large scale distributed computing needs.
To add to your project: Maven:
<dependency>
<groupId>io.github.jrlucier.xoro</groupId>
<artifactId>xoroshiro128plus</artifactId>
<version>1.1</version>
</dependency>
Gradle:
implementation 'io.github.jrlucier.xoro:xoroshiro128plus:1.1'
Example with a random seed:
final Xoroshiro128Plus rng = new Xoroshiro128Plus();
final int randomInt = rng.nextInt();
Example specifying a single seed:
final Xoroshiro128Plus rng = new Xoroshiro128Plus(123456);
final int randomInt = rng.nextLong();
Example specifying a both states:
final Xoroshiro128Plus rng = new Xoroshiro128Plus(123456, 789012);
final int randomInt = rng.nextLong();
This is licensed as Creative Commons Attribution 4.0 International (CC BY 4.0): https://creativecommons.org/licenses/by/4.0/
Feel free to use it in your own project or modify as necessary.
- Tommy Ettinger - The author of the original Java port for SquidPony's SquidLib: https://raw.githubusercontent.com/SquidPony/SquidLib/master/squidlib-util/src/main/java/squidpony/squidmath/XoRoRNG.java
- Sebastiano Vigna and David Blackman, which created the underlying algorithm: http://xoroshiro.di.unimi.it/xoroshiro128plus.c