Sha256: 75c13cc50b0e81550787e22c69984f992fe83530505ac77b6957fd7aab76a639

Contents?: true

Size: 596 Bytes

Versions: 6

Compression:

Stored size: 596 Bytes

Contents

require 'omf-oml/table'

# Create a table containing 'amplitude' measurements taken at a certain time for two different 
# devices.
#

def irwin_hall_distribution(n, m, table, name) 
  n.times do |i|
    s = 0
    m.times do |j|
      s += Kernel.rand();
    end
    table.add_row [i, name, s / m]
  end
end

schema = [[:t, :int], [:device, :string], [:value, :float]]
table = OMF::OML::OmlTable.new 'irwin_hall', schema #, :max_size => 30
irwin_hall_distribution 10000, 10, table, 'm = 10'
irwin_hall_distribution 10000, 1, table, 'm = 1'

require 'omf_web'
OMF::Web.register_datasource table

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
omf_web-0.9.6 example/demo/data_sources/histogram.rb
omf_web-0.9.5 example/demo/data_sources/histogram.rb
omf_web-0.9.4 example/demo/data_sources/histogram.rb
omf_web-0.9.3 example/demo/data_sources/histogram.rb
omf_web-0.9.1 example/demo/data_sources/histogram.rb
omf_web-0.9 example/demo/data_sources/histogram.rb