EDUCATOR-1290 | Create a new random.Random instance when selecting from library content blocks.
This commit is contained in:
committed by
Alex Dusenbery
parent
4e82734cc2
commit
82d5bef4f6
@@ -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.")
|
||||
|
||||
Reference in New Issue
Block a user