标签: ruby random rubygems
我很难用nyaplot绘制以下指数分布图...
require 'distribution' # use the same rng for each call rng = Random 1.step(5, 0.1) do |mean| lambda = mean**-1 # sample a value sample = Distribution::Exponential.p_value(rng.rand, lambda) end
它应该是一个分散的图表: