This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Java in General and the fly likes How to generate a random hour? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to generate a random hour?" Watch "How to generate a random hour?" New topic
Author

How to generate a random hour?

Jack Bolton
Ranch Hand

Joined: May 08, 2006
Posts: 65
How can I generate a random date in java?
[ April 21, 2007: Message edited by: Jack Bolton ]
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

Get today's date and add/subtract a random number to the number of days. But why do you want to do this ?


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Jack Bolton
Ranch Hand

Joined: May 08, 2006
Posts: 65
I'm sorry, my question is:

how to generate a random hour?
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

Generate a random number between 0 and 24 using Math.random()
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to generate a random hour?
 
It's not a secret anymore!