3 ms·
Can I just say how surprised I am the many people have a favourite prime number generator. I can’t say I have a favourite but I do enjoy multiplying two random
by nemo8551 3y ago
Can I just say how surprised I am the many people have a favourite prime number generator.
I can’t say I have a favourite but I do enjoy multiplying two random prime numbers with each other and using the random result when I need a random number with added random.
- cobaltoxide 3y agoThat doesn't seem like a good way to generate "random" numbers, since it will only produce numbers with exactly two prime factors.
- amenghra 3y agoCorrect. It will almost never produce an even number, so there's already one bit of entropy lost. It will also never produce lots of other numbers.
- nemo8551 3y agoThanks all, I hadn’t considered that but we do only use it for silly things and nothing work related but it’s worth a consideration.
- andrelaszlo 3y agoA way to add even more random is to generate a list of N random primes, then shuffling it M times before multiplying the elements. N and M are of course random positive integers. To add maximum random, sometimes I like to return a string with a random Gertrude Stein quote, segfault, or make the PC speaker beep instead of returning a number. So random!