 So one of the things we always want to do inside of a programming language is we want to be able to generate Random numbers in Python. No different. I want to be able to generate these random numbers because if we think about every video game or every Some of the mathematical equations out there mathematical algorithms like Monte Carlo simulation They use random to sort of help kind of do stuff So how do I kind of work it as you guys can clearly see from the thingy up there? I can use the random library. So how do I do that? I come in and I simply go through my import statement like I normally would with any library and I call it random Now all of a sudden I have the ability to work through Random numbers I go random. I use the dot notation and that's going to show me a Whole slew of different options. Now the one I want to focus in on right away is just something called random Now when I do random dot random, I know this sounds super weird. I get a random number. If I were to do it again I get a random number. I do it one more time I get a random number, but you're starting to notice there's a slight pattern to it You see when I do random dot random as soon as I open up these parentheses We're going to see an x which is in an interval of sort of square bracket o and parentheses 1 Well, this is kind of referring to what we call inclusive and exclusive. You see this square bracket What that's indicating is that I'm actually going to be Including zero, but I'm not going to be including one in this occasion And so all of a sudden I get sort of a you know decimal point Okay, well, that's not really beneficial to me at all You know, I would really like to be able to generate maybe a whole number. Maybe I want to generate something like I don't know zero to 99 Including that. Well, okay. All right fair enough Well, the way we can think about it is we can actually look at this as a Percentage and that's if we think about it. That's exactly what a percentage is say 75 Sorry 75 percent really is just me saying 0.75 so we can kind of look at this is generating some percentage And what that allows me to do is kind of think about it in the regards of maybe I come in And I do some multiplication 100 All right, so I'm now getting 77. I'm getting a whole I'm getting a number larger than zero That's gonna be somewhere between zero and 100. All right But I've got that, you know a decimal point. That's just kind of hanging around there So how can I get rid of that? What I can do is I can take this entire statement that I have random dot random times 100 and I can wrap it inside of An int remember an integer turns it into a whole number and whatever the decimal point was It gets rid of it So I come in I take this entire mathematical equation. I've put in and I can hit in oh 25 nice little number there I do it again. Oh 36 nice little number there. I promise you I promise you I can't guarantee this But I promise you we are not gonna see 25 or 36 again. Oh, thank goodness. Very close 75 I was right So, okay, maybe you don't want to have to do the int random dot random Times a hundred all the time Well, what I can do is I can also come in and I can use something called random dot Rand int Now Rand int as soon as I open these parentheses what it's gonna tell me it's gonna do is return a random integer from a To be including a to be so if I say one To a hundred Then what I should see is some random number from one to a hundred If I go a little crazier and I say one two Million I should get a number randomly from one to a million Now one thing that we do want to kind of tuck Touch on real quick is that random is not actually random. You see it goes against the very laws of Mathematics and physics to kind of say oh, I can just produce a random number. You know, that's the point of random You shouldn't be able to kind of calculate it out And in fact a lot of programming languages actually use something called the Mersenne twister algorithm Now if you hop on the Wikipedia's for a second, you see we got the Mersenne algorithm and you can kind of come down. There's actually a link inside there known as Python implementation You can actually see this is the code This is the code inside of Python that is used to generate out a random number Because again, it has it can't just come from thin air It has to come from something you see it kind of goes through the song in answer Shifting 11 bits to the left or right shift then shift them to the left and shift them to the left Then shift them to the right it does all these things and that is how I get a number kind of interesting