File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Android Security Essentials Live Lessons 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: 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()
 
 
subject: How to generate a random hour?
 
Similar Threads
MySql Random Alphanumeric number
random number generation
True Random Numbers
random number generation
Arrays