[PATCH 04/11] include support for a simple pseudo number generator
andy.pont at sdcsystems.com
Thu Jun 17 09:26:58 EDT 2010
Sascha Hauer wrote...
> +#define RAND_MAX 32767
> +/* return a pseudo-random integer in the range [0, RAND_MAX] */
> +unsigned int rand(void);
> +unsigned int rand(void)
> + random_seed = random_seed * 1103515245 + 12345;
> + return (random_seed / 65536) % 32768;
The return value on this function seems wrong as it will always return a
value between 0 and 32767 irrespective of what RAND_MAX is set to which
doesn't agree with the comment on the function prototype.
Although it may just be me being dim as my hayfever is driving me mad today
More information about the barebox