Skip to content

Instantly share code, notes, and snippets.

@zaru
Created February 15, 2020 10:03
Show Gist options
  • Select an option

  • Save zaru/77bca67ac59f393e62bcbb8a7c98bcc7 to your computer and use it in GitHub Desktop.

Select an option

Save zaru/77bca67ac59f393e62bcbb8a7c98bcc7 to your computer and use it in GitHub Desktop.
require 'random_bell'
require 'csv'
require 'securerandom'
bell = RandomBell.new
CSV.open("./files/data_sum_#{ARGV[0]}.csv",'w') do |csv|
head = Date.new(2019, 1)
tail = Date.new(2020, 12)
(head..tail).each do |date|
date.strftime('%Y-%m-%d')
(1..1000).each do |c_id|
client_id = "c#{c_id}"
(bell.rand * 50).ceil.times do
pv = (bell.rand * 200).ceil
uu = (bell.rand * 200).ceil
residence_time = (bell.rand * 10).ceil
url = "/#{(bell.rand * 9999999).ceil.to_s.rjust(7, '0')}/#{SecureRandom.uuid}"
csv << [client_id, date, url, pv, uu, residence_time]
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment