#!/usr/bin/octave -qf % 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. function value=randu(), global randu_state=1; value=randu_state=mod(65539*randu_state, 2**31); endfunction if length(argv) != 1 fprintf(stderr,"Usage:\n\t%s (number of values to generate*)\n",program_name); fprintf(stderr,"\n* '0' -> unlimited\n"); exit(-1); endif max_iter = sscanf(argv{1}, "%d"); if max_iter < 0 fprintf(stderr, "Error: parameter must be non-negative\n"); exit(-1); endif if max_iter == 0, while (true), disp(randu()); end else for i=1:max_iter, disp(randu()); end endif