
fj.Rng Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of functionaljava Show documentation
Show all versions of functionaljava Show documentation
Functional Java is an open source library that supports closures for the Java programming language
The newest version!
package fj;
public abstract class Rng {
public abstract P2 nextInt();
public abstract P2 nextLong();
// [low, high] inclusive
public final P2 range(int low, int high) {
return nextNatural().map2(x -> (x % (high - low + 1)) + low);
}
public final P2 nextNatural() {
return nextInt().map2(x -> x < 0 ? -(x + 1) : x);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy