Score:1

Program to predict a 5-bit output from mersenne Twister random module from python

cn flag

Is there a program to predict the mersenne twister random module in python for a 5-bit integer output, provided the consecutive 3994 outputs are available? The random module is not seeded so i guess, it'll use the system time as it's seed value since no os.random function is used! and it's seeded only once(assumption). Does my claims look valid! and is it really predictable? please forgive me if i'm wrong, i'm just beginner.

fgrieu avatar
ng flag
At least, 3994×5 bits gets you slightly more bits than there are in the state of the standard MersenneTwister, thus I see no information-theoretic impossibility. Asking for recommendation about an existing program (as in a github or something) is off-topic, but discussing about what techniques one would use seems OK to me, even though the MersenneTwister is not intended for use in cryptographic applications. If the question gave a formal definition of the variant of MersenneTwister targeted, including how the 5-bit outputs are obtained, that would help.
Mohammed Siddique avatar
cn flag
@fgrieu let's assume it's a 32-bit variant, and also if the 3994outputs were unsequential although i've mentioned consecutive in my question. if there were some missing outputs and we don't know if they are actually missing but we have 3994, is it still possible to fine the seed?
Mohammed Siddique avatar
cn flag
@fgrieu also, i forgot to mention this in the question... since 3993.6*5 gets 19968 i couldn't write the program for float values so does mentioning n as 3994 causes flaw in the predictor?
fgrieu avatar
ng flag
Non-consecutive outputs will make the problem more difficult, but I see no reason why it would make it impossible, unless the outputs are deliberately located to make the task impossible (like, $2^{20000}-2^{63}$ words apart). Again, to solve that problem, we need to know how the 5-bit outputs are extracted from the output of the Mersenne Twister, and a model of the particular Mersenne Twister used. Reverse engineering the Python one is rather off-topic. Using floats to count things is seldom a good idea, forget about that. If you tried something, perhaps explain what (in the question).
Mohammed Siddique avatar
cn flag
the 5-bit outputs are extracted from the mersenne twister using the python randint(0, 31) function and it doesn't use systemrandom also the seed value is initiated only once. The program i tried to reverse engineer is not complete. Sorry i don't know reverse engineering the python is off-topic, i am new to this @fgrieu
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.