Skip to content

Latest commit

 

History

History
52 lines (42 loc) · 1.62 KB

Readme.md

File metadata and controls

52 lines (42 loc) · 1.62 KB

Xoroshiro128+ for Java

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 Usage

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();

License

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.

Credit