Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Randomly populate different fields in a calculation?

Featured Replies

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.

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.

  • Author

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.

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.

 

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.