This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund 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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply 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: 6588
    
    1

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 - SCJP Mocks - SCJP 5 Mock exam (Word document ) - SCJP 5 Mock exam in Java.Inquisition format
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: 6588
    
    1

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?
 
Similar Threads
random number generation
MySql Random Alphanumeric number
True Random Numbers
random number generation
Arrays