class Statistics::Uniform
- Statistics::Uniform
- Statistics::ContinuousDistribution
- Reference
- Object
Overview
This class represents a random variate from the flat (uniform) distribution from a to b.
Defined in:
gsl/base/statistics.crConstructors
Class Method Summary
- .pdf(x : Float64, a : Float64, b : Float64) : Float64
-
.sample(n : Int, a : Float64, b : Float64)
Returns samples from X ~ U(a,b).
-
.sample(a : Float64, b : Float64)
Returns a sample from x ~ U(a,b).
Instance Method Summary
-
#sample : Float64
Returns a sample from x ~ U(a,b).
Instance methods inherited from class Statistics::ContinuousDistribution
sample : Float64
sample
Constructor Detail
Class Method Detail
def self.sample(n : Int, a : Float64, b : Float64)
#
Returns samples from X ~ U(a,b).
Uniform.sample(5, 0.0, 1.0) # => [0.0124, 0.2145, 0.9303, 0.8617, 0.4556]
def self.sample(a : Float64, b : Float64)
#
Returns a sample from x ~ U(a,b).
Uniform.sample(0.0, 1.0) # => 0.0124
Instance Method Detail
def sample : Float64
#
Returns a sample from x ~ U(a,b).
u = Uniform.new 0.0, 1.0
u.sample # => 0.0124