Blankman
Blankman

Reputation: 266988

How to create a random time within a range

How can I create a random time within a time interval? I want to create a random time between 9am and 11:30am.

Upvotes: 2

Views: 331

Answers (1)

Josh Brody
Josh Brody

Reputation: 5363

use rand()

rand(Time.parse('9 am')..Time.parse('11:30 am'))

Upvotes: 9

Related Questions