// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
public class MyRan {
    private long seed;
    public MyRan(int seed) {
      this.seed = seed;
    }
   public int nextInt() {
      seed = (16807 * seed) % Integer.MAX_VALUE;
      return (int)seed;
   }
   public double nextDouble() {
      seed = (16807 * seed) % Integer.MAX_VALUE;
      return (seed/(double)Integer.MAX_VALUE);
   }
   public static void main(String[] args) {
      MyRan rng = new MyRan(12345);
      for(int i = 0; i < 10; i++) {
         System.out.println(rng.nextInt());
      }
      for(int i = 0; i < 10; i++) {
         System.out.println(rng.nextDouble());
      }
   }
}
