Working on a Win32 API GUI application in Modula-2 (ISO) and there does not appear to be a way to generate random numbers in the libraries. Before I roll my own PRNG (for fun simulation purpose only, does not need to be cryptographically sound), is there a way to get a random number from Windows?
Asked
Active
Viewed 901 times
0
-
1Modula-2 has a Rand lib: FROM Rand IMPORT RANDOM; – Mitch Wheat Jan 21 '21 at 00:34
-
4There's [BCryptGenRandom](https://learn.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptgenrandom) that only needs a buffer to be filled when passed the `BCRYPT_USE_SYSTEM_PREFERRED_RNG` flag. – IInspectable Jan 21 '21 at 00:38
-
@MitchWheat That would be nice and easy, but there's no Rand lib that I can find in the ISO libraries. Using XDS 2.60 currently, but also checked in ADW just to make sure. – Brian Knoblauch Jan 21 '21 at 00:54