random module gives same results across all configurations?

Carl Banks pavlovevidence at gmail.com
Wed Mar 4 08:05:46 CET 2009

On Mar 3, 6:59 pm, Amir  Michail <amich... at gmail.com> wrote:
> Hi,
> Is it the case that the random module will always give the same
> results if given the same seed across all configurations (e.g.,
> architectures, compilers, etc.)?

If you need a repeatable sequence, such as for unit testing, you can
subclass random.Random to do it.  (See the source code to random.py
for example.)

Carl Banks

More information about the Python-list mailing list