/* The Great Win32 Language Shootout http://dada.perl.it/shootout/ contributed by Isaac Gouy (Nice novice) To compile: nicec --sourcepath=.. -d=. -a random.jar random To run: java -jar random.jar 900000 */ import java.text.*; import ackermann; // reuse toSingleInt void main(String[] args){ var n = toSingleInt(args); double result = 0.0; while (n-- > 0) result = gen_random(100.0); println(floatFormat(9).format(result)); } let int IM = 139968; let int IA = 3877; let int IC = 29573; var int seed = 42; double gen_random(double max) { seed = (seed * IA + IC) % IM; return( max * seed / IM ); } NumberFormat floatFormat(int digits){ NumberFormat f = NumberFormat.getInstance(); f.setGroupingUsed(false); f.setMaximumFractionDigits(digits); f.setMinimumFractionDigits(digits); return f; }