From b080f3afb73f21ae6d715a8c8c39319dda1af113 Mon Sep 17 00:00:00 2001 From: deadvey Date: Wed, 17 Dec 2025 20:28:58 +0000 Subject: [PATCH] Added functionality for random question generation with `gen_by_name` Updated the README to explain it --- README.md | 11 +- docs/mathgenerator.html | 129 ++++++++++++++++++----- docs/mathgenerator/_gen_list.html | 6 +- docs/mathgenerator/_latexBuilder.html | 6 +- docs/mathgenerator/algebra.html | 6 +- docs/mathgenerator/basic_math.html | 6 +- docs/mathgenerator/calculus.html | 6 +- docs/mathgenerator/computer_science.html | 6 +- docs/mathgenerator/geometry.html | 6 +- docs/mathgenerator/misc.html | 6 +- docs/mathgenerator/physics.html | 6 +- docs/mathgenerator/statistics.html | 6 +- docs/search.js | 2 +- mathgenerator/__init__.py | 32 +++++- 14 files changed, 170 insertions(+), 64 deletions(-) diff --git a/README.md b/README.md index bf7d71e..138d1b0 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,13 @@ # mathgenerator Fork of
Adding more Physics and Computer Science questions
+As well as randomly generated questions
A math problem generator, created for the purpose of giving teachers and students the means to easily get access to random math exercises to suit their needs. To try out generators, go to -See [CONTRIBUTING.md](https://github.com/lukew3/mathgenerator/blob/main/CONTRIBUTING.md) for information about how to contribute. +See [CONTRIBUTING.md](CONTRIBUTING.md) for information about how to contribute. ## Table of Contents * [Installation](#installation) @@ -31,9 +32,11 @@ import mathgenerator problem, solution = mathgenerator.addition() #another way to generate an addition problem using genById() -problem, solution = mathgenerator.genById(0) +problem, solution = mathgenerator.gen_by_id(0) ``` -You may prefer to use `import mathgenerator as mg` and run functions like `mg.addition()` so that you don't have to type as much. +You may prefer to use `import mathgenerator as mg` and run functions like `mg.addition()` so that you don't have to type as much.
+You can also use `gen_by_name()` to generate a random question. If no subject is specified, a random question from the whole set is chosen. If a subject is specified but no topic, a random question from that subject is chosen.
+Note, if a subject and a topic are both specified, the same type of question will always be returned. -You can also use `getGenList()` to return a list of all generators included in the library in the format: +You can also use `get_gen_list()` to return a list of all generators included in the library in the format: ``` [funcname, subjectname] ``` diff --git a/docs/mathgenerator.html b/docs/mathgenerator.html index df2dd86..6fec9ae 100644 --- a/docs/mathgenerator.html +++ b/docs/mathgenerator.html @@ -3,14 +3,14 @@ - + mathgenerator API documentation - +