Open HasanShaikh opened 7 years ago
You will need at least 24 previous values (since they give you around 2 bits of info each and the rng state is 48 bits) otherwise you will find a large number of states that happen to match by chance. For example if you told me the last value was 3, then by chance, 1/4 of all possible states could've produced that value.
Assuming you do have a large number of previous observations, the approach in repository will still be too slow. It's just doing a dumb brute force and you don't have any initial value to narrow down the search space so you have to search through most of the 2^48 possible seeds. Something like Z3 might be better but I haven't tried it.
@fta2012 I'm in a similar situation as @HasanShaikh , but with a larger interval. In my case I've got:
String token = ((Integer)ThreadLocalRandom.current().nextInt(10000000, 100000000)).toString();
As far as I could tell from reading the code the ReplicatedRandom
class doesn't implement a method for predicting the seed when nextInt
is called with an interval such as 10000000-100000000, correct?
Are you aware of any similar tool which implements this?
I don't think ThreadLocalRandom uses the same prng algorithm as Random so this repo wouldn't have helped anyway. I don't know of any similar tools.
I am generating random values from java random() between 1 to 4.
Every time i am getting a random number between 1 to 4. i want to know the next random number from previous random number which i got. Is it possible to do so.