Is there a straight-forward way to extend this rand() function (from K&R’s “The C Programming Language”) to yield 64 random bits instead of 15?
int rand()
{
rand_next = rand_next * 1103515245 + 12345;
return (unsigned int)(rand_next/ 65536) % 32768;
}
EDIT: And what I mean by that is changing it to use 64-bit numbers and different magic numbers. As opposed to throwing this in a for loop.
EDIT #2: This algorithm is effectively 15 bits of randomness, not 30. Stupid math mistake in my original post.
Linear congruential generators exist for any number of bits.
For 64 bits, MMIX (for example) uses the following recursive formula: