This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Documentation for random module should indicate that a call to seed() is not required
Type: Stage:
Components: Documentation Versions:
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: Justin.Lebar, ezio.melotti, georg.brandl, rhettinger
Priority: normal Keywords:

Created on 2010-01-30 06:05 by Justin.Lebar, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg98551 - (view) Author: Justin Lebar (Justin.Lebar) Date: 2010-01-30 06:05
Many programmers are used to languages where the RNG is deterministic unless it's explicitly seeded.  This does not appear to be the case in Python.

The documentation for random should indicate that Random objects are seeded on construction, and that the global random object is seeded when the random package is first imported.

http://docs.python.org/3.1/library/random.html
msg98552 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2010-01-30 06:15
It's already indicated in the documentation for random.seed([x]):
"If x is omitted or None, current system time is used; current system time is also used to initialize the generator when the module is first imported."
msg98553 - (view) Author: Justin Lebar (Justin.Lebar) Date: 2010-01-30 06:20
Ack.  I read it twice looking for that line!

Perhaps it should still indicate that new Random objects are automatically seeded.  And perhaps the line I missed should be a little bit louder?
msg98605 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2010-01-31 04:36
ISTM, the docs are fine in this regard.  The very long history of this module suggests that this is not a recurring point of confusion.
History
Date User Action Args
2022-04-11 14:56:57adminsetgithub: 52057
2010-01-31 04:36:30rhettingersetstatus: open -> closed

nosy: + rhettinger
messages: + msg98605

assignee: georg.brandl -> rhettinger
2010-01-30 06:20:19Justin.Lebarsetstatus: pending -> open

messages: + msg98553
2010-01-30 06:15:15ezio.melottisetstatus: open -> pending
priority: normal

nosy: + ezio.melotti
messages: + msg98552
2010-01-30 06:05:54Justin.Lebarcreate