Fix testing now that random.sample() arg must be a sequence (#94052)
This is only enforced in 3.11 but the change is not bad for other versions either (and this is test code so perf is not a concern).
Pull Request resolved: https://github.com/pytorch/pytorch/pull/94052
Approved by: https://github.com/Skylion007, https://github.com/malfet