Sha256: 5888bf3a2dce46cabe4677012346f8c61dc5aeec9cfbbcdf4f552ac4cc02e6ac

Contents?: true

Size: 596 Bytes

Versions: 14

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

14 entries across 14 versions & 1 rubygems

Version Path
omf_web-1.2.9 example/demo/data_sources/histogram.rb
omf_web-1.2.8 example/demo/data_sources/histogram.rb
omf_web-1.2.7 example/demo/data_sources/histogram.rb
omf_web-1.2.6 example/demo/data_sources/histogram.rb
omf_web-1.2.5 example/demo/data_sources/histogram.rb
omf_web-1.2.4 example/demo/data_sources/histogram.rb
omf_web-1.2.3 example/demo/data_sources/histogram.rb
omf_web-1.2.2 example/demo/data_sources/histogram.rb
omf_web-1.2.1 example/demo/data_sources/histogram.rb
omf_web-1.2.0 example/demo/data_sources/histogram.rb
omf_web-1.0.0 example/demo/data_sources/histogram.rb
omf_web-0.9.9 example/demo/data_sources/histogram.rb
omf_web-0.9.8 example/demo/data_sources/histogram.rb
omf_web-0.9.7 example/demo/data_sources/histogram.rb