 So before moving on with loops, I want to take a second in just look at something called math dot random now We talked about the math class sort of last week, but we kind of glossed over this one And this is actually a really good Function method that we we have at our disposal, especially now that we've gotten into loops Math dot random allows us to have sort of this idea that we can run multiple infinite large numbers of Simulations and so how it operates is basically math dot random works in the simple set that It's going to generate a random number from zero Including zero including zero To 1.0 Not including it so not Including it and the reason why is because that allows me to have you know 0.0 all the way up 0.0 all the way down to 0.9999 Forever not forever Why do we do this? Well, you know random number that doesn't terribly help us right off the bat But now what we can do with this is we can treat this like it's a percent So suddenly if I want to say well, give me a random number You know random number from 10 Well, I can't do that just yet but what I can do is by multiplying this by Taking this math that random and then multiplying it by some number some in what that allows me to have is a random number from Zero to in minus one now why not in again? We don't include 1.0, so I can't multiply by 100% if you want to think of it like that Now why that's well we think remember again computers count from zero So we are still generating a possibility of 100 numbers We are just starting at zero So how do I continue with that train of thought? How would I generate say number from one to a hundred? Well, what I could do is I could look at it and say all right. Well, I know my bottom My lower bound my lower bound will be a one What that means is I'm always going to start at least at a one Well, what happens if again math dot random generates a 0.0 all zeros all the way Luckily what that means is we can take that and we can multiply it and then that'll give us a zero because it's zero But we add a one we add that so suddenly what we can do is we can add that lower Bound if you want to think of it like that as Sort of my cap and it'll always at least be that bottom number now What about the upper bound say I again I said I wanted to generate a random number from one to a hundred Well, I can generate it from 99 or In this case if we kind of deviate first I can and we say I want to Generate a number this time from 50 to 99 What I can look at this and say is well suddenly My lower bound is 50. I'm going to generate at least a 50 no matter what What's my upper bound? Well a hundred technically, you know, I want to that's my upper bound What's the difference between my upper and My lower Well 50 a hundred minus 50 gives me 50 So I'm going to actually generate a random number from zero to 50 that random number is going to be you know anywhere from zero to 49 Then in turn we add this so it'd be zero Let's see zero to forty nine plus 50 So I get now 50 to 99 now one thing we have to do while we do this is we do have to cast all of this as an integer and the reason why is because guess what that's a decimal place That's a decimal place. So if I do Percentage and I do multiplication of you know 50 I'm gonna get you know some number. It's just arbitrarily say I get 10 percent of 50, which is 10 I'm gonna get 10 point Stuff and I don't want that. So what we're doing is we're casting it as an integer to Truncate the decimal place