Kafka
Joined 17 years ago
Karma
245
Submissions
51
Member since
Sep 23
[ my public key: https://keybase.io/jonelf; my proof: https://keybase.io/jonelf/sigs/dCHC8PfORlVzdGCyjCLOwaTPix8gTGKjykrPNk8Kd_M ]
View on Hacker NewsJoined 17 years ago
n=1234567;(1..n).reduce{|t,n|s=i=0;loop{i+=1;s+=rand;break if s>=1};t+i}.to_f/n"ah, actually 1.1.x isn't vulnerable. The issue first arrived in 2.0" - https://twitter.com/tenderlove/status/288777229276704768
On another note, I believe that this is why native still is around.
# Ethiopian Multiplication
# usage: ruby em.rb 673 7
m, n = ARGV.map(&:to_i)
product = 0
while m >= 1
puts "%4d : %4d %s" % [m, n, m.even? ? "Ignore" : ""]
product += n unless m.even?
m = m / 2
n = n * 2
end
puts "Product: #{product}"
https://gist.github.com/3660240