<?php
/*
 $Id: random.php,v 1.4 2001/05/16 05:30:59 doug Exp $
 http://www.bagley.org/~doug/shootout/
*/
define("IM", 139968);
define("IA", 3877);
define("IC", 29573);

$LAST = 42;
function gen_random ($max) {
    global $LAST;
    return( ($max * ($LAST = ($LAST * IA + IC) % IM)) / IM );
}

$result = 0;
$N = ($argc == 2) ? $argv[1] : 1;
while ($N--) {
    $result = gen_random(100);
}

printf("%.9f\n", $result);
?>