From 8334c42a2314c8b82d8ff6567c7339a045763fed Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Thu, 2 Aug 2018 09:28:16 +0300 Subject: [PATCH] Try to get rid of random2.py. See https://github.com/shlomif/PySolFC/issues/88 . Tests currently fail with python3. --- pysollib/pysolrandom.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/pysollib/pysolrandom.py b/pysollib/pysolrandom.py index 28fd6aa7..b62f0bd7 100644 --- a/pysollib/pysolrandom.py +++ b/pysollib/pysolrandom.py @@ -27,12 +27,7 @@ import sys import re import time from pysollib.mfxutil import SubclassResponsibility -try: - import random2 -except ImportError: - raise ImportError( - "You need to install " + - "https://pypi.python.org/pypi/random2 using pip or similar.") +import random if sys.version_info > (3,): @@ -101,13 +96,15 @@ class BasicRandom: # * uses the standard python module `random' # ************************************************************************ -class MTRandom(BasicRandom, random2.Random): +class MTRandom(BasicRandom, random.Random): def __init__(self, seed=None): if seed is None: seed = self._getRandomSeed() BasicRandom.__init__(self) - random2.Random.__init__(self, seed) + random.Random.__init__(self, seed) + if sys.version_info > (3,): + self.seed(a=seed, version=1) self.initial_seed = seed self.initial_state = self.getstate() self.origin = self.ORIGIN_UNKNOWN