# File lib/rantly/generator.rb, line 144 def float(distribution=nil, params={}) case distribution when :normal params[:center] ||= 0 params[:scale] ||= 1 raise "The distribution scale should be greater than zero" unless params[:scale] > 0 # Sum of 6 draws from a uniform distribution give as a draw of a normal # distribution centered in 3 (central limit theorem). ([rand, rand, rand, rand, rand, rand].reduce(0, :+) - 3) * params[:scale] + params[:center] else rand end end