* io.c (rb_open_file): encoding in mode string was ignored if perm is
[ruby-svn.git] / benchmark / bm_so_random.rb
blob83c0d6d380e4162a201072a71aa35601dc6cb932
1 # from http://www.bagley.org/~doug/shootout/bench/random/random.ruby
3 IM = 139968.0
4 IA = 3877.0
5 IC = 29573.0
7 $last = 42.0
9 def gen_random(max)
10   (max * ($last = ($last * IA + IC) % IM)) / IM
11 end
13 N = 1000000
15 i=0
16 while i<N
17   i+=1
18   gen_random(100.0)
19 end
20 # "%.9f" % gen_random(100.0)