DEADSOFTWARE

License project under GNU GPL 3.
[LongFlight.git] / Crypto / src / code / kalter / longflight / crypto / Random.java
1 package code.kalter.longflight.crypto;
3 /**
4 * ГПСЧ
5 *
6 * @author Kalter
7 */
8 public class Random {
10 private int next;
12 public Random(int next) {
13 this.next = next;
14 }
16 public int random() {
17 next ^= (next << 13);
18 next ^= (next >>> 17);
19 next ^= (next << 5);
20 return Math.abs(next);
21 }
23 public int random(int max) {
24 return random() % max;
25 }
26 }