Jump to content

Randomly populate different fields in a calculation?


This topic is 2561 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have a simple multiplication table solution ("times tables") that I have made for my daughter and I'd like to improve it and would appreciate some guidance with the strategy to implement it.

Currently the records are presented in the format a*b=c, with a*b presented and the input is made into the answer field "c". Currently the times tables to be tested are selected (e.g. for 7 times tables b=7), then the number of questions desired for the test are selected.  The records for the table are then created by scripting in a loop from 1*b to 12*b then sorted randomly and the appropriate number of records omitted to show the desired number of records for the test.

I would like to make two improvements - firstly to present the equation as 2 known values and one unknown, with either a or b or c requiring the input. Secondly I would like the option to extend the learning by introducing multiplication by 10, 100 or 1000 to the values in the equation.

My initial thoughts for the first part were to create a table with all of the possible combinations of 2 knowns and 1 unknown, and find related records (e.g. for 7 times table all the records where a=7 or b=7). This strategy would require a lot of records and the same strategy would be impractical for the second part of the improvement.

I'm thinking that a combination of calculation and scripting would be necessary but was hoping for some early suggestions before continuing as I'm not even sure that my current strategy for creating the records is the best way so building on that may be undesirable.

Any help will be greatly appreciated.

Link to comment
Share on other sites

I am not sure I followed your description fully. From what I think I understood, I believe you should have a permanent bank of records, in the amount that corresponds to the maximal number of questions you want to present at one time. Then have a script populate those records, optionally omit some to reduce the number of questions, and shuffle them.

You can have the script randomly populate either b or c. The problem then becomes how to present the two types so that the subject can only enter an answer into the blank field.

Link to comment
Share on other sites

Yes comment I think you have it right. I'm guessing that alternate layouts or tabs could be used depending on which field is blank as only one record will be presented at a time. I'm not entirely sure how to proceed but will start with trying to populate the scripts randomly for now. Thanks.

Link to comment
Share on other sites

13 minutes ago, muzz said:

I'm not entirely sure how to proceed

Think how you would do this manually - then tell your script to do it for you. I don't know what your exact rules are, but I can give you an example:

  1. pick a random number for $a;
  2. populate all records with FieldA = $a and FieldB = serial incrementing number;
  3. pick a random subset of records and set FieldC to the result, then clear FieldB;
  4. sort by random.

 

Link to comment
Share on other sites

This topic is 2561 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.