Is it possible to reverse a pseudo random number generator? For example, take an array of generated numbers and get the original seed. If so, how would this be implemented?
You can also go backwards with an LCG, it is just another LCG using the inverse of the multiplier modulo the modulus, together with a suitable increment. For your small numbers you can just use brute force to search for the inverse, in general it can be computed with an extended GCD algorithm.
Pseudo Random Number Generator (PRNG) Software-generated random numbers only are pseudorandom. They are not truly random because the computer uses an algorithm based on a distribution, and are not secure because they rely on deterministic, predictable algorithms.
The outcome of the research confirms the possibility that machine learning algorithms can be trained to predict certain PRNGs. Even when trained with a small amount of data, there is evidence that machine learning algorithms can be used to predict the values created by pseudorandom number generators.
Instead they rely on algorithms to mimic the selection of a value to approximate true randomness. Pseudo random number generators work with the user setting the distribution, or scope from which the random number is selected (e.g. lowest to highest), and the number is instantly presented.
This is absolutely possible - you just have to create a PRNG which suits your purposes. It depends on exactly what you need to accomplish - I'd be happy to offer more advice if you describe your situation in more detail.
For general background, here are some resources for inverting a Linear Congruential Generator: Reversible pseudo-random sequence generator
pseudo random distribution which guarantees all possible permutations of value sequence - C++
And here are some for inverting the mersenne twister: http://www.randombit.net/bitbashing/2009/07/21/inverting_mt19937_tempering.html http://b10l.com/reversing-the-mersenne-twister-rng-temper-function/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With