3 # $Id: heapsort.ruby,v 1.5 2005-04-14 15:59:37 igouy-guest Exp $
5 # The Great Computer Language Shootout
6 # http://shootout.alioth.debian.org/
8 # modified by Jabari Zakiya
15 def gen_random (max
) (max
* ($last = ($last * IA
+ IC
) % IM
)) / IM
end
28 if ((ir
-= 1) == 1) then
36 if ((j
< ir
) and (ra
.at(j
) < ra
.at(j
+1))) then
39 if (rra
< ra
.at(j
)) then
50 N
= Integer(ARGV.shift
|| 1)
51 ary
= Array
.new(N
) { gen_random(1.0) }
55 printf
"%.10f\n", ary
.last