class Statistics::Uniform

Overview

This class represents a random variate from the flat (uniform) distribution from a to b.

Defined in:

gsl/base/statistics.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class Statistics::ContinuousDistribution

sample : Float64 sample

Constructor Detail

def self.new(a : Float64, b : Float64) #

[View source]

Class Method Detail

def self.pdf(x : Float64, a : Float64, b : Float64) : Float64 #

[View source]
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]

[View source]
def self.sample(a : Float64, b : Float64) #

Returns a sample from x ~ U(a,b).

Uniform.sample(0.0, 1.0) # => 0.0124

[View source]

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

[View source]