PDA

View Full Version : RtlGenRandom -> Rnd, Rnd64


Lloigor
2nd December 2011, 15:59
I was looking for a way to get random numbers, and found http://nsis.sourceforge.net/Random. Nice one but it returns the same results given the same seed.

So i digged google and msdn and came across the api function RtlGenRandom (http://msdn.microsoft.com/en-us/library/aa387694.aspx).
I used SystemFunction036 because, like they said: "This function has no associated import library. This function is available as a resource named SystemFunction036 in Advapi32.dll."

I made two functions with it, they're working very well, so i've put them on the wiki: http://nsis.sourceforge.net/Rnd,_Rnd64.

Should still work post win7: "Finally, the statement that it may disappear in future versions is rather unlikely: the Microsoft C Runtime Library makes use of this function in its implementation of "rand_s". " (msdn comment added on 6/16/10)