#!/usr/bin/env ruby # 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. $randu_state=1 def randu(); $randu_state = (65539*$randu_state) % 2**31; end if ARGV.length != 1 $stderr.puts "Usage:\n\t#{ARGV[0]} (number of values to generate*)\n"+ "\n* '0' -> unlimited"; exit -1; end max_iter=Integer(ARGV[0]) if max_iter<0; $stderr.puts "Error: param must be non-negative"; exit -1; end if max_iter==0; while(true); puts randu(); end else max_iter.times { puts randu() }; end