Вы должны использовать целое число для seed
вместо числа с плавающей запятой.
Python 3.5.3 на Raspberry Pi:
Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import random
>>> random.seed(9248459222926972)
>>> [random.randint(1, 1000) for x in range(5)]
[586, 818, 989, 122, 519]
Python 3.7.3 в Windows x64:
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import random
>>> random.seed(9248459222926972)
>>> [random.randint(1, 1000) for x in range(5)]
[586, 818, 989, 122, 519]
В случае, если вы работаете с библиотечным кодом, который может вызывать random.*()
"в фоновом режиме", вы можете также рассмотреть возможность создания своего собственного засеянного ГСЧ, используемого только вашим кодом:
import random
rng = random.Random()
rng.seed(9248459222926972)
# ...