Comments

Yes, this is unfortunate. I feel like we have a ticket for this (it's certainly known) but I couldn't find it right away - it may be part of one of the other tickets about the `RealDistribution` stuff.

A computer can not create randomness out of nothing. To build pseudo-random numbers, it needs to start from a "seed", which is assumed to be random. If you do not provide a seed, the computer will try to forge a seed that looks random, for example it will look at the keys you hit on the keyboard, the webpages that your web browser visited, the date, etc, and build a seed from that. Now, given a seed, it will use some algorithm to provide a lot of pseudo-random numbers, the randomness of this sequence of numbers will depend on the seed (a determiistic algorithm can not create randomness out of nothing).

Fixing a seed allows you to start from something you control completely, and then be able to reproduce your tests (the seed is fixed and the algorithm is deterministic). If you fix twice the same seed, you will get twice the same sequence of pseudo-random numbers:

Now, if you do not fix a seed, and do the following from two different sage sessions, you should get different values:

sage: variance = 0.75
sage: gaussian = RealDistribution('gaussian', variance)
sage: gaussian.get_random_element()
# random number that depends on the seed that is built
# according to the state of your computer.

If you want to write tests that need to output the same result along the time, use a fixed seed. If you want to make independent tests, don't !