]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-142527: Docs: Clarify that random.seed() discards the sign of an integer input...
authorAndrej <andrej.karpathy@gmail.com>
Fri, 19 Dec 2025 08:29:35 +0000 (00:29 -0800)
committerGitHub <noreply@github.com>
Fri, 19 Dec 2025 08:29:35 +0000 (00:29 -0800)
commit610aabfef2f90dc1a274703779615aa5b7fbbb3a
treed71441f3ecc00c5ad4e462d8a238b283d8317f5b
parent220f0b107776391201a399c54dd01692c36fcdf4
gh-142527: Docs: Clarify that random.seed() discards the sign of an integer input (#142483)

If *a* is an integer, the sign of *a* is discarded in the C source code. Clarify this behavior to prevent foot guns, where a common use case might naively assume that flipping the sign will produce different sequences (e.g. for a train/test split of a synthetic data generator in machine learning).

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Doc/library/random.rst