Windows equivalent of /dev/random
WindowsRandomWindows Problem Overview
Is there a way to generate random number on Windows by reading from a file or psuedo-file or character special file, the way that can be done on Linux by reading from /dev/random?
Windows Solutions
Solution 1 - Windows
Yes, it's called Microsoft CryptoAPI.
Solution 2 - Windows
This link from StingyJack's answer is good: http://en.wikipedia.org/wiki/CryptGenRandom
Microsoft C++ Visual Studio since 2005 offers rand_s()
which works on Windows XP and up. It is based on RtlGenRandom
(as are CryptoAPI's PRNG functions), whose inner workings are not made public. It seems in XP there were some weaknesses that have since been fixed.
Personally, I use rand_s()
as an additional source of randomness to seed a PRNG of my choice.
Solution 3 - Windows
If you're doing .NET development you can use the RandomNumberGenerator class.