Community Explorer

## Formula Questions - complicated random numbers

The formula question example shows how to ask students ridiculously easy questions like "What is [x] + 5?"

Or "Calculate the weight of [x] blue whales."

For those of us who don't teach elementary school, this is not useful.

I want give my students a random number between, say 100,000 and 250,000. And I do NOT want a random number of 197,476. I want to generate [x] between 1 and 10, with 1 decimal place, and then multiply that times 15,000, and add the product to 100,000, to get numbers like 241,500, not 197,476.

Why on earth am I not allowed to do something like the following.

Annual sales are [x*15000+100000]?

2 Solutions
Community Explorer

James –

Thanks for sharing your blog post. It’s a heavy lift, but it’s nice to know that it can be done.

What I ended up doing is creating 5 versions of each problem to be randomly assigned.

And thanks for that tip about generating multiples of 100 by padding the random number with 0’s. I did not know that was possible. I had tried to play around with different attempts like that, but I was just shooting the dark and didn’t have the syntax right.

That tip alone is going to be useful in writing homework problems.

Thanks!

Ron

Community Novice

I have just made a chrome extension that does exactly what you need and then some. You can get it here:

Turn on "Extended" and add these to your formulas:

• x = range(1, 10, 0.1)
• a = x*150000 + 100000
• ... continue with whatever formula you need
• last formula is the answer

The extension page has my email. Email me if you have any questions!

6 Replies
Community Champion

Why on earth am I not allowed to do something like the following.

Annual sales are [x*15000+100000]?

Because Canvas didn't include that functionality. Canvas has stopped development on legacy quizzes and has a plan in place to deprecate it and push everyone to new quizzes. The functionality doesn't exist there either. It's been asked about multiple times and several feature requests have been made for it. Most of those requests have been archived because there math and science and formula questions doesn't have the same audience as multiple choice or fill in the blank questions.

Overall, math and science support in quizzing is very lacking. Canvas is definitely not trying to be a full-functioned math/science testing platform -- you may need to use a third-party program if you want that.

As for how to get Canvas to do what you're asking for, I wrote a blog post a little over a year ago that explains how you can hack Canvas to get it to do this: Using Calculated Values in the Text of Formula Questions

In the past, I've used three solutions, depending on how difficult the problem is. I can generate multiple versions of the question by hand. I've also used Excel to generate the questions and then import them into Respondus to send to Canvas. A third thing I've done is to write a program that would generate the question. In all of these cases, I think put the questions into a question group in Canvas to simulate the random number generation that would happen.

If you wanted it to be multiples of 10, then you could pad it with 0 yourself. That is, generate a random number between 10 and 20 and then use "[a]0,000" in the question. There's no way to do that with multiples of 15,000.

Here are some links to other places in the Community where people have talked about this. Items that are archived are unavailable to people unless they join the cold storage group.

Community Explorer

James –

Thanks for sharing your blog post. It’s a heavy lift, but it’s nice to know that it can be done.

What I ended up doing is creating 5 versions of each problem to be randomly assigned.

And thanks for that tip about generating multiples of 100 by padding the random number with 0’s. I did not know that was possible. I had tried to play around with different attempts like that, but I was just shooting the dark and didn’t have the syntax right.

That tip alone is going to be useful in writing homework problems.

Thanks!

Ron

Community Novice

I have just made a chrome extension that does exactly what you need and then some. You can get it here:

Turn on "Extended" and add these to your formulas:

• x = range(1, 10, 0.1)
• a = x*150000 + 100000
• ... continue with whatever formula you need
• last formula is the answer

The extension page has my email. Email me if you have any questions!

Community Explorer

James, the first two links give are dead and the next couple are not public.

Community Champion

The links were valid at the time the post was written. Canvas switched the software they were using in early August and decided to migrate all of the content to the new site, but the URLs changed for everything. Only some of the items had redirects added for them, so much remains a broken link. When I come across a broken link, I use the search capability to find the right page. I did that to find the links to Using Calculated Values in the Text of Formula Questions and Using Python to create Calculated Questions.

Community Participant

Wow, this was really helpful!  Thank you, James!