class Statistical::Rng::Frechet

Attributes

alpha[R]
generator[R]
location[R]
scale[R]

Public Class Methods

new(dobj = nil, seed = Random.new_seed) click to toggle source
# File lib/statistical/rng/frechet.rb, line 15
def initialize(dobj = nil, seed = Random.new_seed)
  if dobj.nil?
    raise ArgumentError, 'Need a alpha-parametrized Frechet object!'
  elsif !dobj.is_a?(Statistical::Distribution::Frechet)
    raise TypeError, "Expected Frechet Distribution found #{dobj.class}"
  end

  @generator = Random.new(seed)
  @alpha = dobj.alpha
  @location = dobj.location
  @scale = dobj.scale
  @sdist = dobj
end

Public Instance Methods

==(other)
Alias for: eql?
rand() click to toggle source

Return the next random number from the sequence

@return [Float] next random number in the sequence

# File lib/statistical/rng/frechet.rb, line 32
def rand
  return @sdist.quantile(@generator.rand)
end
type() click to toggle source

Return the type of the source distribution

@return source distribution's type

# File lib/statistical/rng/frechet.rb, line 51
def type
  @sdist.class
end

Private Instance Methods

eql?(other) click to toggle source

Compare against another rng to see if they are the same

@return true if and only if, source distributions are the same and the

prng has the same initial state
# File lib/statistical/rng/frechet.rb, line 40
def eql?(other)
  return other.is_a?(self.class) &&
         @generator == other.generator &&
         @alpha == other.alpha &&
         @location == other.location &&
         @scale == other.scale
end
Also aliased as: ==