[Icfp04-discuss] Need help with random function

Laurent Desnogues laurent.desnogues at wanadoo.fr
Sun Jun 6 17:32:21 EDT 2004


Jeroen van den Belt wrote:

> can anybody help with the randomint function
> 
> 
> I dont get the values which are written in the task description.
> 
> I use this:
> 
> 
> static long seed=12345;
> 
> int randomint( int n)
> {
> 	long s= seed * 22695477+1;
> 	int x = (s / 65536)%16384;
> 	x= x % n;
> 	seed =s;
> 	return x;
> }

We are not supposed to discuss implementations but
I can give you one hint:

    x_i is a function of s_{i+4}

Good luck,

		Laurent



More information about the Icfp04-discuss mailing list