Re: Predict math.random(0) last bit
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Predict math.random(0) last bit
- From: Albert Chan <albertmcchan@...>
- Date: 2018年4月24日 12:06:54 -0400
128 math.random(0) last bit can actually predict the sequence,
not just the last bit
let c = last bit LSFR coefficients = (c1, c2, ..., c128)
let x = last bit of 128 math.random(0) = (x1, x2, ... x128)
x129 = (c . x) & 1 -- predict last bit using vector dot product
Within the full period 2^128 - 1, all x's are unique
(otherwise, last bit period will be LESS than 2^128 - 1)
But, xorshift128+ only have 2^128 - 1 possible seeds
-> x and seed must map 1-to-1
-> x (after solving the seed) can predict the sequence.