317163 (3) [Avatar] Offline
The following adjusted test passes, which show's that JavaRNG does not have a functional interface:
  public void testInteger() {
    RNG rng = JavaRNG.rng(0);
    assertEquals(Integer.valueOf(-1155484576), Generator.integer(rng)._1);
    assertEquals(Integer.valueOf(-723955400), Generator.integer(rng)._1);
    assertEquals(Integer.valueOf(1033096058), Generator.integer(rng)._1);
Pierre-Yves Saumont (124) [Avatar] Offline
Yes, there has been a problem with the JavaRNG class. The intent was to transform it into a functional one by extracting the random generation code from the java.util.Random class.

Here is the code that should have replace this class:

public class JavaRNG implements RNG {

  private final long seed;

  private JavaRNG(long seed) {
    this.seed = seed;

  private JavaRNG() {

  private long nextSeed(long seed) {
    return (seed * 0x5DEECE66DL + 0xBL) & ((1L << 48) - 1);

  public Tuple<Integer, RNG> nextInt() {
    return new Tuple<>((int)(seed >>> 16), new JavaRNG(nextSeed(seed)));

  public static RNG rng(long seed) {
    return new JavaRNG(seed ^ 0x5DEECE66DL & ((1L << 48) - 1));

  public static RNG rng() {
    return new JavaRNG();

This uses a simplified version of the generating code in the java.util.Random class.

This code must be used in exercises 12_01 to 12_09. And as the generating code is slightly different, all tests must use different expected values. I have updated the Github repo.
317163 (3) [Avatar] Offline
Great! Thanks for the response.