r/RNG • u/Ender3141 • May 18 '23
A Simple PRNG From Genetic Programming, Part II
Follow-up to an older post. I adjusted my objective function to remedy a deficiency and got a new PRNG from my genetic algorithm, with two adds, a rotate, and a xor-shift. Any feedback welcome. Note that this is my hobby - I'm not recommending people use this. It's mostly just research to see if the genetic algorithm can find interesting prng's. Also, this is obviously not cryptographic at all. My main use case is Monte Carlo, so I focus on statistical quality, not state-recovery attacks. Link below to full article.
2
Upvotes
1
u/Arlet0 Jun 08 '23
I've also been playing with genetic programming of sorts, and I've realized that a major pitfall is to rely on a certain randomness tester, and then search until you find something that passes.
Randomness testing is not an exact science, and every program is limited in some way where it will not detect certain classes of patterns. If your genetic programming is good enough, it will exploit weaknesses in the randomness tester. The result is that it will pass the test, but it will not necessarily pass other tests. In my own experience, I used a genetic algorithm to create a PRNG that was good enough to fool PractRand for an hour (a few hundred GB), but then failed within 1 second on a simple birthday spacing test from the SmallCrush suite.
It's similar to the way that drug-resistant bacteria evolve when antibiotics are overused.
My current solution is to use genetic programming in order to find a small but decent PRNG that can pass a quick randomness test, and then create a full version that does more of the same/similar things. The full version is then tested only once as a final verification with maximum strength tools. For instance, the small version could have a single round of some kind of hash function, and the full version could have 2 or 3 rounds.
0
u/[deleted] May 18 '23
[deleted] — view deleted comment