@jutge.org/toolkit 4.4.16 → 4.4.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -110,6 +110,7 @@ For a complete walkthrough, see the [Getting Started Guide](docs/getting-started
110
110
 
111
111
  - **[Getting Started Guide](docs/getting-started-guide.md)** - Complete guide to using the toolkit
112
112
  - **[Problem Anatomy](docs/problem-anatomy.md)** - Understanding problem structure and files
113
+ - **[Quiz Anatomy](docs/quiz-anatomy.md)** - Understanding quiz problems and question types
113
114
  - **[JutgeAI Features](docs/jutge-ai.md)** - Using AI to generate content
114
115
 
115
116
  ### Installation Guides
@@ -1,19 +1,26 @@
1
1
  # type: ignore
2
2
 
3
3
  """
4
- Execute some Python code given from stdin
4
+ Execute some Python code given from stdin and seed random number generator with argv[1].
5
5
  and print all resulting global variables as JSON.
6
6
  """
7
7
 
8
8
  import json
9
9
  import sys
10
10
  import types
11
+ import random
11
12
 
12
13
  # Read the code from stdin
13
14
  code = sys.stdin.read()
14
15
 
16
+ # Seed random number generator
17
+ seed = int(sys.argv[1])
18
+ random.seed(seed)
19
+
15
20
  # Create a namespace for execution
16
- namespace = {}
21
+ namespace = {
22
+ 'seed': seed # this makes sure that some variables are always present
23
+ }
17
24
 
18
25
  # Execute the code in the namespace
19
26
  exec(code, namespace)