# -*- mode: icon -*-
# $Id: random.icon,v 1.2 2001/05/08 01:51:39 doug Exp $
# http://www.bagley.org/~doug/shootout/
$define IM 139968
$define IA 3877
$define IC 29573
procedure gen_random(max)
static LAST; initial LAST := 42;
repeat { suspend((max * (LAST := (LAST * IA + IC) % IM)) / IM) }
end
procedure main(argv)
n := argv[1] | 1;
every i := 2 to n do gen_random(100.0)
# Icon has fixed number of output decimal points to 9, bogus!
write(gen_random(100.0))
end