#!/usr/bin/env perl # 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; sub randu() { $randu_state = (65539 * $randu_state) % 2**31; } if (@ARGV != 1) { print stderr "Usage:\n\t$0 (number of random values to generate*)\n". "\n* '0' -> unlimited\n"; exit -1; } $max_iter = $ARGV[0]; die "Error: parameter must be a natural number" if (not $max_iter =~ /^\d+$/); for ($i = 0; $i < $max_iter || !$max_iter; $i++) { print randu()."\n"; }