I'm trying to figure out a formula that can "reverse" or "crack a pseudoRNG, my goal is to be able to plug in the past results of the the pseudoRNG and reverse calculate it in order to figure out the seed number or code so that I can plug it back into the rng and be able to accurately predict the next sequence it will generate, idk if this is even possible or if anything like this even exists but its a concept I need help on.
Reverse psudo random number generating
2.3k Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail AtThere are 2 best solutions below
On
here is an example from Visual Studio 2008 which I still use, it took my PC about 1 second to generate all the possible pseudo randoms, I can use the list to find the next pseudo random - note that I went back to the old VB6 (1999) pseudo random number generator, not now available in the latest versions of Visual Studio
As I say, ISpy or reflector might even show you the calculations behind various calculations - I'm sure no two generators will be guaranteed to be alike. Some generators build up random entropy pots from 'random' system events (an example is a mouse move event, the time, size, and direction of a mouse move can be stored to provide random input to a proper random number generator)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim pseuds As New List(Of Single)
For i As Integer = 1 To 17000000
pseuds.Add(Microsoft.VisualBasic.Rnd)
Next
Dim op As Single = Rnd()
Dim key As Integer = pseuds.FindIndex(Function(x) CBool(x = op))
Dim NextP As Single = pseuds(key + 1)
MessageBox.Show(String.Format("next pseud = {0} : predicted = {1}", Microsoft.VisualBasic.Rnd, NextP))
End Sub
from the .net help on random number generator
Pseudo-random numbers are chosen with equal probability from a finite set of numbers. The chosen numbers are not completely random because a mathematical algorithm is used to select them, but they are sufficiently random for practical purposes. The current implementation of the Random class is based on a modified version of Donald E. Knuth's subtractive random number generator algorithm. For more information, see D. E. Knuth. The Art of Computer Programming, Volume 2: Seminumerical Algorithms. Addison-Wesley, Reading, MA, third edition, 1997.
The whole point of pseudorandom numbers is that this is impossible; if they were easy to predict, then they wouldn't be properly random. For some specific types of p-random number generators we know how to do this -- which in fact makes them bad p-random number generators, and as a result we usually do not use them anymore.