Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I want to develop a method to compute the seed value after n steps. I first wanted to use a loop, but I thought maybe someone comes up with a nice single expression and could also say something about the process.

I guess you have to use mathematical induction to solve that...

$x_0 = \mathtt{seed}$

$ x_1 = (x_0 \cdot \mathtt{0x5DEECE66D} + \mathtt{0xB})~\mathtt{AND}~((1~ \mathtt{SHIFTL}~48) - 1) $

$x_n = \dots$

All the values are 64-bit java long numbers. More information can be found here: http://docs.oracle.com/javase/6/docs/api/java/util/Random.html#next%28int%29. What I basically want to do is to copy an instance of Random object, so that copy behaves same.

share|improve this question
    
I managed to create a copy of a random object stackoverflow.com/a/18531276/1809463. But I'm still interested in the solution, though. –  mike Aug 30 '13 at 13:39

1 Answer 1

I suggest using this service.

Or, if you want to write the code yourself, I suggest starting here.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.