EDUCATOR-1290 | Create a new random.Random instance when selecting from library content blocks.

This commit is contained in:
Alex Dusenbery
2018-03-14 10:38:35 -04:00
committed by Alex Dusenbery
parent 4e82734cc2
commit 82d5bef4f6

View File

@@ -176,7 +176,8 @@ class LibraryContentModule(LibraryContentFields, XModule, StudioEditableModule):
pool = valid_block_keys - selected
if mode == "random":
num_to_add = min(len(pool), num_to_add)
added_block_keys = set(random.sample(pool, num_to_add))
rand = random.Random()
added_block_keys = set(rand.sample(pool, num_to_add))
# We now have the correct n random children to show for this user.
else:
raise NotImplementedError("Unsupported mode.")