1

So, I've come across some answers and comments about random_device either being bugged or it purposefully using a deterministic method as a fallback when a non-deterministic method can't be used on the implementation.

As a matter of fact, I'm on Windows using GCC and I can't use random_device because of that problem (every created instance returns the same number). I know you could use time() but this isn't ideal either as seeds are identical when created in the same second.

What are portable alternatives that can be used for seeding PRNG?

TrveBlack
  • 63
  • 4
  • You can use Boost, I don't know about all the platforms that it supports, but it will solve your problem on Windows – Praetorian Oct 05 '17 at 21:49
  • Depends on how you define "portable". In my ojrandlib, for example, I detect what OS I'm running on and use CryptGenRandom() if I'm on Windows and /dev/urandom if I'm on Linux/Mac. – Lee Daniel Crocker Oct 06 '17 at 00:56

0 Answers0