This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
New question... how can I retrieve the computer's current date/time. I want to do this to ensure completely random numbers when generating random numbers (i.e. running through 'n' number of random numbers where 'n' = day*month*year/seconds*minutes/hour or something similar. Also, is there an easier way to get a completely random number? Is there any way to randomize the seed #? Let me know... Thanks!
Want a free iPod, digital camera, or $300 cash? Completely legit offer at <a href="http://www.geocities.com/pricklymustard/freestuff.html" target="_blank" rel="nofollow">http://www.geocities.com/pricklymustard/freestuff.html</a> . I am looking for referrals which is why I need YOU!
Here is the code for geting current minutes on your PC:
I hope this helps you, for more info read about Calendar and Date class in java.util package
kind regards Igor [ February 18, 2005: Message edited by: Igor Stojanovic ]
Joined: Nov 20, 2004
Thanks! That definitely helps!
Joined: Nov 20, 2004
NOTE: Something I just found for anyone who later references this post... if you use the default constructor for the Random class (public Random()) rather than using something like (public Random(0)), it will use the current system time in milliseconds as the seed value. So randomness is nothing to worry about when using the default contstructor.
If you need a more robust random number generator, you can use SecureRandom. It is part of Java's cryptography model, and different security providers can provide their own implementations.
When I was doing SSL programming, the SecureRandom we used would spawn several Threads and perform timing calculations for twenty seconds to generate a seed value. Others could be written to use random numbers generated by hardware. It all boils down to how random you need the numbers to be.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com