Guest User

Untitled

a guest
Dec 12th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.18 KB | None | 0 0
  1. class Time
  2. def self.random(t1, t2)
  3. int = t2.to_i - t1.to_i
  4. at(t1.to_i + rand(int+1))
  5. end
  6. end
  7.  
  8.  
  9. Time.random Time.now, Time.parse("2012/12/31")
  10. => Tue Nov 06 10:25:17 +0100 2012
Add Comment
Please, Sign In to add comment