From 82d5bef4f6e1db3c08fb449a9e2cafe6d5f7ee9b Mon Sep 17 00:00:00 2001 From: Alex Dusenbery Date: Wed, 14 Mar 2018 10:38:35 -0400 Subject: [PATCH] EDUCATOR-1290 | Create a new random.Random instance when selecting from library content blocks. --- common/lib/xmodule/xmodule/library_content_module.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/library_content_module.py b/common/lib/xmodule/xmodule/library_content_module.py index 9cc60a47f2..d49eafebb1 100644 --- a/common/lib/xmodule/xmodule/library_content_module.py +++ b/common/lib/xmodule/xmodule/library_content_module.py @@ -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.")