Skip to content

Instantly share code, notes, and snippets.

@azusa azusa/lottery.rb
Created Nov 13, 2011

Embed
What would you like to do?
TDDBC抽選用プログラム
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require "CSV"
list=Array.new
rows = CSV.open(ARGV[0],"rb:windows-31j")
rows.shift
rows.each do |row|
list.push row
end
list =list.sort_by{|i| rand}
list.each do |row|
row.each do |col|
if col != nil then
print "¥""
print col.encode("windows-31j")
print "¥""
print ","
else
print ","
end
end
print rand(10000)
print "¥n"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.