module Sabina::Utils

Public Class Methods

box_muller(s = 1.0) click to toggle source
# File lib/sabina/utils.rb, line 3
def box_muller(s = 1.0)
  r_1 = rand
  r_2 = rand
  s * Math.sqrt(-2*Math.log(r_1)) * Math.cos(2*Math::PI*r_2)
end

Private Instance Methods

box_muller(s = 1.0) click to toggle source
# File lib/sabina/utils.rb, line 3
def box_muller(s = 1.0)
  r_1 = rand
  r_2 = rand
  s * Math.sqrt(-2*Math.log(r_1)) * Math.cos(2*Math::PI*r_2)
end