Re: trying to predict next rand value
From: Bill Unruh (unruh_at_string.physics.ubc.ca)
Date: 10/29/04
- Next message: Mok-Kong Shen: "Re: Q: Finding primitive polynomials"
- Previous message: Skybuck Flying: "Re: Data Compression Before or After Encryption ?"
- In reply to: Skybuck Flying: "Re: trying to predict next rand value"
- Next in thread: Douglas A. Gwyn: "Re: trying to predict next rand value"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: 29 Oct 2004 16:28:49 GMT
"Skybuck Flying" <nospam@hotmail.com> writes:
]Well I figured it out myself now lol...
]This C line is nicely obfuscated... ;)
]I was wondering what was returned... holdrand after or before calculating...
]return(((holdrand = holdrand * 214013L + 2531011L) >> 16) & 0x7fff);
]I should read this as:
](holdrand = holdrand * 214013L + 2531011L);
]return ((holdrand >> 16) & 0x7fff);
]Bingo ! ;)
]( So it does actually two things in one line
]1. Update the holdrand variable
]2. Calculate some random value and return it ;)
Well, hardly random, but yes. In C a statement
holdrand = holdrand * 214013L + 2531011L
evaluates to the LHS. Thus your interpretation is correct.
- Next message: Mok-Kong Shen: "Re: Q: Finding primitive polynomials"
- Previous message: Skybuck Flying: "Re: Data Compression Before or After Encryption ?"
- In reply to: Skybuck Flying: "Re: trying to predict next rand value"
- Next in thread: Douglas A. Gwyn: "Re: trying to predict next rand value"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|
|