I am using GAP (see https://www.gap-system.org/) in a number theory class to display a variety of number theoretic functions and number theory problems. I've written code in GAP to implement the RSA encryption scheme but unfortunately, the random number generation I am using (x := Random([1..10^18]); ) gives every student the same random number! The goal is for each student to generate two random primes of a certain length and use them in their RSA encryption. This is, of course, defeated if we all get the same "random" number!
How do I force GAP to choose something truly random, something that cannot be duplicated by another student?
Expanding my comment to include an example. You can use really random sources provided by the IO package. It should be loaded by
LoadPackage("io");although in most cases it will be loaded by default, if available. Windows GAP distribution includes IO binaries, so that should not be a problem to run it on Windows. Linux and MacOS users should have it compiled.Then try the following:
Now, in a new GAP session I have
so it seems to work as you need.
On the other hand, Alexander's number fits the purpose, and does not require you to modify an existing code by adding an additional argument to calls to
Random, so I suggest to go for it.