Author vstinner
Recipients docs@python, johnnyd, mark.dickinson, rhettinger, vstinner
Date 2018-01-15.09:13:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
random.seed(str) uses:

        if version == 2 and isinstance(a, (str, bytes, bytearray)):
            if isinstance(a, str):
                a = a.encode()
            a += _sha512(a).digest()
            a = int.from_bytes(a, 'big')

Whereas for other types, random.seed(obj) uses hash(obj), and hash is randomized by default in Python 3.

Yeah, the random.seed() documentation should describe the implementation and explain that hash(obj) is used and that the hash function is randomized by default:
Date User Action Args
2018-01-15 09:13:25vstinnersetrecipients: + vstinner, rhettinger, mark.dickinson, docs@python, johnnyd
2018-01-15 09:13:25vstinnersetmessageid: <>
2018-01-15 09:13:25vstinnerlinkissue32554 messages
2018-01-15 09:13:25vstinnercreate