Last active
August 29, 2015 14:00
-
-
Save neon-izm/11146414 to your computer and use it in GitHub Desktop.
Paiza Online Hackathon vol.2 testdata genarator
This file contains 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
# paiza online hackathon testdata generator | |
# https://paiza.jp/poh/paizen | |
#画面サイズ、各最大300 | |
h=230 | |
w=219 | |
#ウィジェットの数 最大300*300? | |
widget_num=40000 | |
File.open('outstr.txt','w'){|f| | |
#画面サイズ書き込み | |
str=sprintf("%d %d\n",h,w) | |
f.write str | |
#画面内容書き込み | |
h.times do | |
w.times do | |
#0が75%くらいの割合で良いのでは? | |
i=rand(2) | |
if i==1 then | |
i=rand(2) | |
end | |
f.write i.to_s | |
end | |
f.write "\n" | |
end | |
#ウィジェット定義 | |
str2=sprintf("%d\n",widget_num) | |
f.write str2 | |
#ウィジェットデータ書き込み | |
widget_num.times do | |
f.write((rand(20)+1).to_s+" "+(rand(20)+1).to_s+"\n") | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment