I use the following code for a seeded pseudo random number generator, and it has worked well for many years.
It is called millions of times per batch in an optimisation algorithm and because of its simplicity it is very fast and of course repeatable.
However, for very low batch quantities i.e under 10 its deficiences are highlighted.
Can anyone suggest a better solution with small code for low batch quantities.
Code:int randomgen( int start, int count ) { /* This generates a pseudo random number generator which can be reproduced at will. */ SEED = ( ( 0XA3ED * SEED ) + 0X1D31 ) & 0X7FFF; return ( abs( ( SEED % ( count - start + 1 ) + start ) ) ); }