[Jprogramming] generating random seed

Stefano Lanzavecchia stf at apl.it
Fri Jun 15 00:03:23 HKT 2007


> even if the pool is low - but by reading only 4 bytes from
> random, I have never encountered a delay. 
[...]
> Is there a similar/good solution in Windows?

CoCreateGUID http://msdn2.microsoft.com/en-us/library/ms688568.aspx
generates exactly 4 bytes.
I use it a lot.

Otherwise you can go down the CryptoAPI route:
http://msdn2.microsoft.com/en-us/library/aa380256.aspx
It's got good COM (CAPICOM) and .NET wrappers (several namespaces in the
standard .NET library).

-- Stef



More information about the Programming mailing list