#!/usr/bin/env ruby
require("gsl")

rng = Rng.alloc
h = Histogram.alloc(100, [0, 15])
for i in 0...10000 do
#  r = rng.exponential(2)
  r = Ran::exponential(rng, 2)
  h.fill(r)
end

result = h.fit_exponential
a = result[0]
b = result[1]

x = Vector.linspace(0, 15, 100)
y = a*Sf::exp(x*b)
graph(h, [x, y], "-C -g 3")

  
