Top Level Namespace

Defined Under Namespace

Classes: Phylip

Instance Method Summary collapse

Instance Method Details

#fisher_yates_shuffle(a) ⇒ Object



2
3
4
5
6
7
# 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) ⇒ Object



8
9
10
11
12
13
14
15
# 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