This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell 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


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: 6661
    
    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: 6661
    
    5

Generate a random number between 0 and 24 using Math.random()
 
GeeCON Prague 2014
 
subject: How to generate a random hour?