0
$\begingroup$

Given the hypothetical fact that I can predict the same entropy value used to generate a random number, can I generate the same random value, say in a Windows based python application?

$\endgroup$
  • $\begingroup$ prediction of seed that generated output != generation of output based on that seed $\endgroup$ – e-sushi Jan 24 '18 at 12:31
1
$\begingroup$

Yes, of course you can do that hypothetically. By definition random numbers are generated based on the entropy together with known values and algorithms. It would of course be necessary to know those constants and algorithms though. Quite often this is possible as the source code for the random number generator is often known in some way or other (open source or research program).

Usually runtimes make use of the random generator of the operating system, and the Microsoft algorithm is pretty complex and may change for different versions of the operating system. However, good random number generation has been known to be complicated on VM's.

Nowadays it may well be that the OS mixes in values of the hardware based RNG on Intel and AMD processors or a TPM module on the motherboard, making it nigh impossible to guess the entropy used to seed the OS PRNG.

TL;DR is it possible? Yes, if you truly know all the entropy - which usually is a questionable assumption. But even then it requires a lot of practical knowledge and a lot of effort.

$\endgroup$
0
$\begingroup$

Are you just asking if Python can repeat it's random numbers? If so, see random.seed(...) @ https://docs.python.org/3/library/random.html#notes-on-reproducibility.

This works like a manual seed on any typical random number generator. Be aware though that the default Python RNG is the Mersenne Twister. That's not cryptographic ally secure. You need to look at the secrets module for secure numbers.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.