
On Tue, Nov 15, 2022 at 12:19:48AM -0600, James Johnson wrote:
The random function in Python is not really adequate for a magic eight ball program,
That is an astonishing claim for you to assert without evidence. Python's PRNG is the Mersenne Twister, which is one of the most heavily studied and best PRNGs known. Yes, it's a bit old now, but it still gets the job done, and is more than adequate for non-security related randomness, including magic eight ball programs. There are PRNGs which are faster, or use less memory, or have better statistical properties, but not usually all at once. The MT is the work-horse of modern PRNGs. What properties do you think it lacks which are necessary for a magic eight ball program? Arguably, the Mersenne Twister is hugely overkill for a M8B program. It has a period of at least 2**19937-1, or about 10**6001 (that's a 1 followed by 6001 zeroes). Which means that if you ran your M8B a billion billion billion times a second, it would take more than a billion billion billion [five thousand more billions] billion years before the cycle of responses started again. Of course there are cleverer ways of predicting the output of a Mersenne Twister than waiting for the cycle to repeat, but it's a magic eight ball. Who cares? Even a 32-bit linear congruential generator, so long as it is not utterly dire, would do the job. -- Steve