All pastes #979501 Raw Edit

Unnamed

public java v1 · immutable
·published 2008-04-10 12:27 UTC
rendered paste body
// $Id: random.java,v 1.11 2001/07/31 16:38:37 doug Exp $// http://www.bagley.org/~doug/shootout///** This copy courtesy of http://www.kano.net/javabench///**  Added Timer() codeimport java.text.*;public class random {    public static final long IM = 139968;    public static final long IA = 3877;    public static final long IC = 29573;    public static void main(String args[]) {	int N = Integer.parseInt(args[0]) - 1;    long start = System.currentTimeMillis();  	NumberFormat nf = NumberFormat.getInstance();	nf.setMaximumFractionDigits(9);	nf.setMinimumFractionDigits(9);	nf.setGroupingUsed(false);	while (N-- > 0) {	    gen_random(100);	}	System.out.println(nf.format(gen_random(100)));    long end = System.currentTimeMillis();     System.out.println("Time: " + (end - start) + " ms");     }    public static long last = 42;    private static double gen_random(double max) {	return( max * (last = (last * IA + IC) % IM) / IM );    }}