Skip to content

Commit

Permalink
Merge pull request #4100 from ASJordi/main
Browse files Browse the repository at this point in the history
Reto #8 - Java
  • Loading branch information
kontroldev authored Jul 12, 2023
2 parents 20eeae2 + 2a89ffe commit eff46e6
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 eff46e6

Please sign in to comment.