Skip to content

Commit b40dcb7

Browse files
committed
Use random.Random in tempfile
1 parent 2fd9eb9 commit b40dcb7

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

Lib/tempfile.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@
4242
import os as _os
4343
import shutil as _shutil
4444
import errno as _errno
45-
# XXX RustPython TODO: _random
46-
#from random import Random as _Random
45+
from random import Random as _Random
4746
import weakref as _weakref
4847

4948
try:
@@ -157,11 +156,7 @@ def __iter__(self):
157156

158157
def __next__(self):
159158
c = self.characters
160-
def choose(s):
161-
import math, random
162-
return s[math.floor(random.random() * len(s))]
163-
# XXX RustPython TODO: proper random impl
164-
# choose = self.rng.choose
159+
choose = self.rng.choice
165160
letters = [choose(c) for dummy in range(8)]
166161
return ''.join(letters)
167162

0 commit comments

Comments
 (0)