class Object
Public Instance Methods
fisher_yates_shuffle(a)
click to toggle source
# File lib/rphylip.rb, line 2 def fisher_yates_shuffle(a) (a.size-1).downto(1) do |i| j = rand(i+1) a[i], a[j] = a[j], a[i] if i != j end end
pseudonormal(x,y)
click to toggle source
# File lib/rphylip.rb, line 8 def pseudonormal(x,y) num = 0 reps = 4 reps.times do num += rand(y - x + 1) + x end num / reps end