Created
January 4, 2009 19:31
-
-
Save fguillen/43158 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
def random_datetime( date_ini = '1970/01/01 10:10', date_end = '2010/01/01 10:10' ) | |
time_ini_int = Time.parse( date_ini ).to_i | |
time_end_int = Time.parse( date_end ).to_i | |
time_random_int = Kernel.rand( time_end_int - time_ini_int ) + time_ini_int | |
return Time.at( time_random_int ) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment