You cannot have a common mistake. Either your algorithm works or not. The reason for this is that the reasonable margin of error is obviously much smaller than RAND_MAX. This, in turn, means that the lower bits are not as random as the higher bits. But a good PRNG ensures that all bits are equally random.
Consider this slow but mathematically sound example of the RNG algorithm:
int rand() { state = AES_encrypt(state); return state % RAND_MAX; } void srand(int seed) { state = AES_encrypt(seed); }
If you can find any significant correlation between the output sequence and the previous state , the AES algorithm should be considered broken.
source share