I've been looking around for code snippets for generating pseudo-random numbers.
A lot of them seem to be very similar, for example

double findnoise(int x)
    int x = (x<<13) ^ x;
    return (double)( 1.0 - ( (x * (x * x * 15731 + 789221) + 1376312589) & Ox7fffffff) / 1073741824.0);   

Can someone tell me what the (x<<13)^x does regarding the random number being produced,please? (I know what << and ^ do as far as writing code is concerned.)


A big hint is the function name - findnoise.

I think the function is grabbing whatever stack value int x happens to have and then applying some operations on it...Hopefully returning a quasi random number.

Please note this is just a guess....Actually I never noticed the function passed an int x. That kind of throws off my guess.