Message389485
Are you sure it's "a list"? At least print out `type(questions_element)`. `random.shuffle()` doesn't contain any code _capable_ of changing a list's length. It only does indexed accessing of the list:
...
for i in reversed(range(1, len(x))):
# pick an element in x[:i+1] with which to exchange x[i]
j = randbelow(i + 1)
x[i], x[j] = x[j], x[i]
That's about all there is to it. Note that, for this purpose, it doesn't matter want `randbelow()` does, because that function never even sees `x`. |
|
Date |
User |
Action |
Args |
2021-03-24 19:30:00 | tim.peters | set | recipients:
+ tim.peters, eric.smith, rowan.bradley |
2021-03-24 19:30:00 | tim.peters | set | messageid: <1616614200.54.0.856420918613.issue43618@roundup.psfhosted.org> |
2021-03-24 19:30:00 | tim.peters | link | issue43618 messages |
2021-03-24 19:30:00 | tim.peters | create | |
|