Answers.Body: <p>Yes, this is possible but only within certain cases and depending on the amount of work one is willing to invest. All PRNGs make use of an underlying (deterministic) generative process that can be learned in theory. This <a href="https://research.nccgroup.com/2021/10/15/cracking-random-number-generators-using-machine-learning-part-1-xorshift128/" rel="nofollow noreferrer">blog post</a> nicely illustrates how it could be done. The model learns to predict the next sequence of random numbers without knowing the seed. This makes intuitive sense since deep nets can approximate arbitrary functions and in practice it is often not even clear what the seed value of the generative process would be (e.g. during image classification).</p>
  <p>In general, this question has no binary answer but instead depends on a number of factors like the complexity of the PRNGs, the available training data, the network size, and the available compute.</p>
  <p>This questions has also been answered <a href="https://ai.stackexchange.com/questions/3850/can-a-neural-network-be-used-to-predict-the-next-pseudo-random-number">here</a> and <a href="https://stackoverflow.com/questions/17371972/is-it-possible-to-predict-the-next-number-in-a-number-generator">here</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-19T11:12:43.090Z
Answers.Text: I think it is worth mentioning that although theoretically possible, it would be impractical (and AFAIK, never been done) for any modern standard PRNG, even the non-cryptographic ones like Mersenne twister.
Answers.UserDisplayName: Neil Slater
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-19T11:16:10.507Z
Answers.Text: The blog post actually also has a very interesting [second part](https://research.nccgroup.com/2021/10/18/cracking-random-number-generators-using-machine-learning-part-2-mersenne-twister/) where they do work with the Mersenne twister and 'break it'.
Answers.UserDisplayName: Mariusmarten
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-19T11:22:04.390Z
Answers.Text: I stand corrected. Partially though, because the blog post approach does require a lot of reverse engineering of the known algorithm in order to apply ML successfully. The answer to the OP's question is still "no" (unless the OP clarifies that knowing the algorithm is allowed).
Answers.UserDisplayName: Neil Slater
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-19T11:43:10.060Z
Answers.Text: Maybe we can agree on the fact that the quality of our predictions will be a function of the complexity of the PRNGs, the available training data, the network size, and the available compute. I will change the answer accordingly.
Answers.UserDisplayName: Mariusmarten
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-19T08:59:45.337Z
Answers.LastActivityDate: 2022-08-19T11:47:35.640Z
Answers.LastEditDate: 2022-08-19T11:47:35.640Z
Answers.UserDisplayName: Mariusmarten
Body: <p>Can any machine learning algorithm predict the function of pseudo random number generator given only its inputs and outputs?</p>
  <p>Here, you can also assume that you don't know the seed for the PRNG.</p>
  
Tags: <machine-learning><function-approximation>
Title: PRNG Function Prediction
UserDisplayName: Midlij
ThreadText: # PRNG Function Prediction
  
  (Asked by: username_0 on 2022-08-18)
  
  Can any machine learning algorithm predict the function of pseudo random number generator given only its inputs and outputs?
  
  Here, you can also assume that you don't know the seed for the PRNG.
  
  **Tags:** machine-learning, function-approximation
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-08-19. Score: 1
  
  Yes, this is possible but only within certain cases and depending on the amount of work one is willing to invest. All PRNGs make use of an underlying (deterministic) generative process that can be learned in theory. This [blog post](https://research.nccgroup.com/2021/10/15/cracking-random-number-generators-using-machine-learning-part-1-xorshift128/) nicely illustrates how it could be done. The model learns to predict the next sequence of random numbers without knowing the seed. This makes intuitive sense since deep nets can approximate arbitrary functions and in practice it is often not even clear what the seed value of the generative process would be (e.g. during image classification).
  
  In general, this question has no binary answer but instead depends on a number of factors like the complexity of the PRNGs, the available training data, the network size, and the available compute.
  
  This questions has also been answered [here](https://ai.stackexchange.com/questions/3850/can-a-neural-network-be-used-to-predict-the-next-pseudo-random-number) and [here](https://stackoverflow.com/questions/17371972/is-it-possible-to-predict-the-next-number-in-a-number-generator).
  
  > **Comments:**
  > **username_2**: I think it is worth mentioning that although theoretically possible, it would be impractical (and AFAIK, never been done) for any modern standard PRNG, even the non-cryptographic ones like Mersenne twister.  
  > **username_1**: The blog post actually also has a very interesting [second part](https://research.nccgroup.com/2021/10/18/cracking-random-number-generators-using-machine-learning-part-2-mersenne-twister/) where they do work with the Mersenne twister and 'break it'.  
  > **username_2**: I stand corrected. Partially though, because the blog post approach does require a lot of reverse engineering of the known algorithm in order to apply ML successfully. The answer to the OP's question is still "no" (unless the OP clarifies that knowing the algorithm is allowed).  
  > **username_1**: Maybe we can agree on the fact that the quality of our predictions will be a function of the complexity of the PRNGs, the available training data, the network size, and the available compute. I will change the answer accordingly.  
  
  ---
  
  