/* Copyright 2005 Daniel Cer (daniel.cer@cs.colorado.edu) This work is licensed under the Creative Commons Attribution-NonCommercial- ShareAlike License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/2.5/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA. */ public class Randu { private int state = 1; // next = 65539*prev % 2**31 public int next() { return state=((state<<16)+(state<<1)+state)&0x7FFFFFFF; } public static void main(String[] args) { if (args.length != 1) { System.err.println( "Usage:\n\tjava Randu (number of random values to generate*)\n"+ "\n* '0' - unlimited"); System.exit(-1); } int maxIter = Integer.parseInt(args[0]); Randu randu = new Randu(); if (maxIter<0) { System.err.println( "Error: parameter must be non-negative"); System.exit(-1); } for (int i=0; (i