I'm studying for random number generators(RNG) and I saw about machine learning a few days ago. So I searched analysis of RNG using machine learning. But I couldn't find such fields. Are there such examples for analysis of RNG using machine learning? No matter some papers of articles.
-
4$\begingroup$ Are you asking if machine learning could analyze THE OUTPUT of a (P)RNG? Or if machine learning could analyze THE DEFINITION of a PRNG? $\endgroup$– fgrieu ♦Mar 26, 2015 at 15:50
-
$\begingroup$ Exactly, I meant that target is THE OUTPUT of PRNG. There are many method to determine randomness of output string. So I just wonder if I can predict some of strings using concept of machine learning. $\endgroup$– Tylor YooMar 27, 2015 at 8:57
4 Answers
The goal of an ideal cryptographically secure pseudo-random number generator (CSPRNG) is to produce a stream of numbers that no machine can distinguish from a truly random stream of numbers. Formally, it's impossible unknown whether it's possible to prove that a CSPRNG is truly random.
That being said, there exists a family of statistical tests that can measure whether a sequence of numbers appears to be uniformly random, and produce a probabilistic analysis as output. I'm not sure if these tests qualify as related to machine learning, but here are some examples:
If you are interested in trying out a CSPRNG, you can use:
- AES-CTR with a random key acting as the seed.
- Under Linux, Mac OS X, BSD,
/dev/urandom
. window.crypto.getRandomValues()
in your browser console (Chrome, Firefox).
Note that not all PRNGs are CSPRNGs.
-
1$\begingroup$ I'm pretty sure those tests are not considered "machine learning". $\endgroup$– Maarten Bodewes ♦Mar 26, 2015 at 15:49
-
$\begingroup$ Shrug I thought so as well, but hopefully my answer can be somewhat helpful either way. $\endgroup$ Mar 26, 2015 at 15:54
-
$\begingroup$ It's good background info, I'm not sure if it qualifies as an answer. AES-CTR is close but not quite a CSPRNG I guess, it does not offer re-seed possibilities for instance. $\endgroup$– Maarten Bodewes ♦Mar 26, 2015 at 16:10
-
1$\begingroup$ You can transform a block cipher in CTR mode into a RNG using NIST's CTR_DRBG, I'm pretty sure. $\endgroup$– pg1989Mar 27, 2015 at 2:28
-
1$\begingroup$ Hi, kaepora. Thank you for your answer. Your answer is really helpful to me. $\endgroup$ Mar 27, 2015 at 8:50
Consider the limitations of such an analysis. It can summarily reject a PRNG as being insufficiently random by demonstrating that the outputs are predictable by a computer program. However, its ability to generate comfort as to the randomness of a PRNG is limited. We have mathematicians going through hoops with months of mathematical analysis to prove that a flaw exists, much less find the flaw outright. Often a "broken" algorithm is shown to break after petabyes of random numbers, which becomes an indication that it will continue to be attacked in less and less time, until any old laptop can break it. Those studying PRNGs would want a little more warning than "a computer program has actually cracked it."
It might be interesting to use such machine learning programs for high performance PRNGs that do not have any cryptographic guarantees. They might be able to help explain to a programmer or artist the limitations of a particular PRNG choice for their particular job, rather than relying on highly abstract measures of unpredictability.
The NIST test suite for random numbers implements "short-term memory" machine learning algorithms.
It needs to save and categorize all relevant data to be "long-term memory" machine learning.
Paper: http://csrc.nist.gov/publications/nistpubs/800-22-rev1a/SP800-22rev1a.pdf
You may use binary classification algorithm like decision tree and have two learning data sets one which has the truly random bytes and the other puesudo random bytes. As you might probably know, you have to specify the size of every record say for example 1k.
It is really a good idea.
-
3$\begingroup$ This (probably) won't work. There is certainly structure in CSPRNG's that could potentially be exploited, but I don't believe naive classification will be powerful enough to yield a distinguisher for any nontrivial CSPRNG. $\endgroup$– ThomasOct 3, 2015 at 11:17