Skip to content

Commit

Permalink
Instantiate RNG in constructor to fix native build
Browse files Browse the repository at this point in the history
  • Loading branch information
SailReal committed Nov 30, 2023
1 parent a7d865c commit f8b1e10
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@
public class RandomMinuteSleeper {

private static final long MINUTE_IN_MILLIS = 60 * 1000L;
private static final Random RNG = new Random();
private final Random rng;

public RandomMinuteSleeper() {
this.rng = new Random();
}

void sleep() throws InterruptedException {
Thread.sleep(RNG.nextInt(0, 60) * MINUTE_IN_MILLIS);
Thread.sleep(rng.nextInt(0, 60) * MINUTE_IN_MILLIS);
}

}

0 comments on commit f8b1e10

Please sign in to comment.