// -*- mode: java -*-
// $Id: random.njs,v 1.4 2001/08/02 20:27:40 doug Exp $
// http://www.bagley.org/~doug/shootout/
// by David Hedbor <david@hedbor.org>

var IM = 139968;
var IA = 3877;
var IC = 29573;
var last = 42;

function gen_random(max) { return(max * (last = (last * IA + IC) % IM) / IM); }

var n, result = 0;
ARGS = WScript.Arguments;
if(ARGS.length > 0) {
    n = parseInt(ARGS.Item(0), "10");
    if (n < 1) n = 1;
} else {
    n = 1;
}
n--;
while (n--) {
    gen_random(100.0);
}

WScript.Echo(gen_random(100.0).toFixed(9));