Skip to content

Commit

Permalink
Reto #8 - Java
Browse files Browse the repository at this point in the history
  • Loading branch information
ASJordi committed Jul 12, 2023
1 parent cba92e9 commit 2a89ffe
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import java.time.LocalTime;

public class PseudoRandomGenerator {

private final LocalTime lt = LocalTime.now();
private int seed = (int) System.currentTimeMillis();

private int generateRandomNumber() {

seed = (seed * 1103515245 + 12345) & Integer.MAX_VALUE;

return seed % 101;

}

public int generateWithNano() {

return (lt.getNano() + 1) / 10000000;

}

}

0 comments on commit 2a89ffe

Please sign in to comment.