<p>After reading this answer:
<a href="https://stackoverflow.com/questions/136474/best-way-to-pick-a-random-subset-from-a-collection#136513">best way to pick a random subset from a collection?</a></p>

<p>It got me wondering, how does one pick a random seed in Java?</p>

<p>And don't say use System.currentTimeMillis() or System.nanoTime().  Read the article to see why not.</p>

<p>That's a hard question, but let me make it harder.  Let's say you need to generate a random seed without connecting to the internet, without using user input (IE, there's no gui), and it has to be cross platform (therefore no JNI to access hardware).</p>

<p>Is there some JVM variables we can monitor as a source of our randomness?</p>

<p>Can this be done?  Or is it impossible?</p>

Take a look at
Uncommons Maths
(full disclosure: I wrote it).  It should solve most of the problems you'll ever have with random numbers in Java.
Even, if you don't use it you should be able to get some ideas from the various
SeedGenerator
implementations it provides.  Basically, it defaults to using
/dev/random
.  If that doesn't exist (e.g. Windows) it either tries to download data from
random.org
or it uses
SecureRandom.generateSeed
.
I think SecureRandom.generateSeed is the best that you can do without relying on anything platform specific or on the Internet.