 Today, I want to show you how to program a question in WebWorks that has randomized values. So I do have my question here above, which I want to program. It had some fixed values and I want to program those to be changeable and therefore be different for each student. So first thing I do, I go to WebWorks and I already created myself a new homework set. And in that set, I'm going to add a new question and then here I'm going to edit it. And now that before I do anything, I'm going to click on new version. I'm going to give it a different name. So this will be my mass spring one. And I'm going to append it to the test bank. So that I have it as a second problem in my test bank. Okay, now this is what I get as a template actually from WebWorks itself. But I have my own templates. I'm going to erase this and I'm going to be editing this for myself. So in my case, this is a question on a single motion. Okay, so now here, the first section is loading some macros. I'm not going to even touch that. And then here I say if we show partial correct answers, this case is going to be for a test. So I decide to know here will be the random variables. The way here, by the way, how I did it with two different randomized things is in order to control the number of significant figures. And here is where I put the question. And actually also have a question context. I should add this here at the beginning. So here is where I'm simply going to copy paste from my question over here. Okay, now question here, I'm going to have question one, which is the first I'm going to program and calculate the amplitude. Actually calculate, let's define the amplitude of the system. And then the answer unit will be in meters. Now I'm going to do the randomization. Okay, so here we had a spring constant of 20 newtons. So in K instead, I'm just going to write here K, let's call this K. So now at this point, it's going to insert me the spring constant K, which now I put in my randomized values instead here was one with ohms. So here I'm going to now update this to randomized values. So K, I want it to be, wait, let's put it with, let's put this with three significant figures. So something factor of 10, maybe not that high, let's go seven. So here I'm not going to use the current anymore. Now here I could do a random value for my initial position as well. However, this is where you have to pay attention when you do this randomized numbers because we don't want any, or there are initial positions that will not be possible for the total energy of the system. So actually, I probably should calculate the solution first, which is the amplitude, and then give a certain percentage of that amplitude as the initial position. So let's calculate the answer first. So the amplitude is the square root of the energy over the spring constant. And now my initial position, I can calculate it as a fraction of the amplitude. So let's do amplitude times and then a random value from 1 to, let's say from 10 to 90 over 100 would give me the amplitude in meters as a fraction of the amplitude, here I had centimeters, so I don't need the 100. Okay, and now my solution was the amplitudes. All I have to do here is answer, I put in here amplitude. And now I think we are ready for part A. I can also select the tolerance for my answers. So where did I put this one? Tolerance, actually I should. Set my tolerance, otherwise it will not work. Oh, here I did it. So here I say 20% tolerance, let's go a bit lower. Let's go with 10% and let's make here another paragraph. And now let's see how this works. So I go on update, which will save it, and then it put me in a new window. If there's any coding issues, it will spit out errors. If it works, let's hope it works. So let's see. Yeah, so here's my question. So a block is attached to spring with, it's total. So I made a typo, edge is in a dual, that seems fine. The block is at, okay, so here, because I randomized it, I got too many, many significant figures. So I'm going to change this. So errors, it's total energy. And then here, let's make question A out of this, because I'm going to add a B later on, the amplitude. So I wanted to round this one here. Let's just round this to full centimeters. Let's see what we get now. Okay, so that's nicer. Spring can't see, okay, okay. So the first part of my problem seems to work right now. If I want to add a second question, all I do is I duplicate my question set up here. I'm going to do the second question. So for the moment, I just leave amplitude and everything as it was as the answer. So here this is question two, answer two, unit, answer two, amplitude. And then now here in the screen output, what I'm going to be doing is I'm going to duplicate this. So question two, so two unit. And then what I have to do here for decorating, I also have to duplicate this one. And here I say, take answer two. So let's see how this looks like. Okay, so right now it should be actually twice the same thing. Yay, and it worked. Or if I put this one wrong, I would tell me which one is correct, which one is wrong. Okay, that's how you program a question with randomized numbers. So right now my spring constant, my total energy, and the initial position, which is completely irrelevant for that first problem here are randomized.