1ä¸ä»¶ã®ãã¹ããã¼ã¿ã使ããã¨ãã ç»é²æ¥ãã©ã³ãã 使ããå¿ è¦ãããã ãããªæãã§ä½ã£ã¦ã¿ã¾ããã âæéãæå®ãã¦ãã©ã³ãã ã«æ¥ä»ãçæããã ã½ã¼ã¹ require 'date' def rand_date(d_from,d_to) from = Date.parse(d_from) to = Date.parse(d_to) days = to - from + 1 return from + rand(days) end 5.times{ puts rand_date("1978-09-30","1980-10-10") } å®è¡çµæ 1979-08-02 1979-08-13 1980-05-03 1979-02-06 1979-01-30 [åè] http://d.hatena.ne.jp/rubyco/20070704/date
{{#tags}}- {{label}}
{{/tags}}