-
-
Save naoty/2059243 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 集合地プログラミングお勉強用コード | |
# テスト用データセット生成 | |
# k0h3yさんが分身して映画をレビューするお | |
# データセットの値が毎回変わるし、検算するの面倒 | |
#dataset = Hash.new | |
#["Kohey", "K0h3y", "Mr. Kohey", "St. Kohey", "Dr. Kohey"].each do |name| | |
# dataset.store(name, Hash.new) | |
# ["STAR WARS", "The Matrix", "The Shawshank Redemptation", "Before Sunrise", "The Notebook"].each do |tittle| | |
# dataset[name].store(tittle, rand(6).to_f) | |
# end | |
#end | |
#puts dataset | |
dataset = {} | |
names = ["Kohey", "K0h3y", "Mr. Kohey", "St. Kohey", "Dr. Kohey"] | |
titles = ["STAR WARS", "The Matrix", "The Shawshank Redemptation", "Before Sunrise", "The Notebook"] | |
names.each {|name| dataset[name] = {}; titles.each {|title| dataset[name][title] = rand(1..5).to_f } } | |
puts dataset | |
# storeってはじめて見たw []= でおk | |
# rand(6)よりrand(1..5)の方がわかりやすいと思う |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment