#!/usr/bin/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. if ARGV.length != 2 $stderr.puts "Usage:\n\t#{$0} [int/real] (count)"; exit -1; end type = ARGV[0]; count = Integer(ARGV[1]) if count <= 0 $stderr.puts "Error: count should be an integer > 0"; exit -2; end if type == "int" count.times { puts rand(0x7FFFFFFF) } elsif type == "real" count.times { puts rand } else $stderr.puts "Invalid type: \"#{type}\""; exit -3 end