mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Merge
This commit is contained in:
commit
112835cb3e
3 changed files with 30 additions and 0 deletions
|
@ -112,6 +112,13 @@ class Random(_random.Random):
|
|||
import time
|
||||
a = int(time.time() * 256) # use fractional seconds
|
||||
|
||||
if version == 1 and isinstance(a, (str, bytes)):
|
||||
x = ord(a[0]) << 7 if a else 0
|
||||
for c in a:
|
||||
x = ((1000003 * x) ^ ord(c)) & 0xFFFFFFFFFFFFFFFF
|
||||
x ^= len(a)
|
||||
a = -2 if x == -1 else x
|
||||
|
||||
if version == 2:
|
||||
if isinstance(a, (str, bytes, bytearray)):
|
||||
if isinstance(a, str):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue