Skip to content

Instantly share code, notes, and snippets.

@neon-izm
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neon-izm/11146414 to your computer and use it in GitHub Desktop.
Save neon-izm/11146414 to your computer and use it in GitHub Desktop.
Paiza Online Hackathon vol.2 testdata genarator
# 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