Skip to content

yaba/PredictRNG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PredictRNG

Why:

This is a simple web app I decided to build after getting stumped by a hackathon puzzle and discovering that there aren't any online plug and play Mersenne Twister number predictors! The goal of this app is to predict future "random numbers" generated by an MT19937 by taking 624 consecutive random numbers and using them to reconstruct the generator's state.

Requirements:

The only way to get correct results is if you have 624 consecutive outputs from a Mersenne Twister. Using the app, you can just paste these numbers and click a button to get future values.

App Requirements:

  • Python 3
  • Django 2.1.2

How to use:

Unfortunately, our precious random numbers are not a click away (yet). Until the app goes live, the quickest way to predict some numbers is to play with the "predictor.py" file in the "predict" folder. Here, you can create a list with your 624 numbers, and pass them to "stateInference" function, along with the number of values you'd like to predict.

How it works:

The 624 known outputs undergo some bit manipulation to undo the tempering done to the state values. After this, the generator's state is now reconstructed, allowing for any future value to be predicted. Using the now known current state, numbers are generated using the same tempering the MT19937 uses. A list of consecutive "random numbers" is returned. Assuming your 624 numbers are correct and in order, this method has 100% accuracy.

predict

TODO:

  • Add input validation.
  • Add test cases / examples for proof.
  • Give the user options such as how many numbers to predict or predicting a specific index.
  • Formatting and front-end stuff.
  • Possibly add option to upload from file and receive file back.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published