scalanlp / breeze

Breeze is a numerical processing library for Scala.
www.scalanlp.org
Apache License 2.0
3.44k stars 691 forks source link

A trivial bug in breeze.stats.distributions.Uniform.scala #834

Closed Sanzo-Miyazawa closed 2 years ago

Sanzo-Miyazawa commented 2 years ago

In breeze.stats.distributions.Uniform.scala:

  case class Uniform(low: Double, high: Double)(implicit rand: RandBasis)
  ...
  ...
x require(low <= high)
  def draw(): Double = rand.uniform.draw() * (high - low) + low

The require statement above should be

  require(low < high)

because 0 <= rand.uniform.draw() < 1.0 and therefore low <= Uniform(low, high) < high.