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 <1516007605.67.0.467229070634.issue32554@psf.upfronthosting.co.za>
In-reply-to
Content
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:
https://docs.python.org/dev/library/random.html#random.seed
History
Date User Action Args
2018-01-15 09:13:25vstinnersetrecipients: + vstinner, rhettinger, mark.dickinson, docs@python, johnnyd
2018-01-15 09:13:25vstinnersetmessageid: <1516007605.67.0.467229070634.issue32554@psf.upfronthosting.co.za>
2018-01-15 09:13:25vstinnerlinkissue32554 messages
2018-01-15 09:13:25vstinnercreate