Lecture 12: Monte Carlo Integration (17)
jayc809

Always wondered how computers can generate random numbers at such an efficient rate. From what I know, there are basically two approaches to random numbers. You can either mathematically derive it using some equation and initial seed or you obtain it from some unpredictable physical process. The former is obviously faster but it is still shocking to me that we are able to generate it so quickly. Just to ballpark, suppose we need a random number for every 8 million rays in a 4k display at 120 fps, we need would need to generate a random number at right around 1 nanosecond, which is not even considering all the other computationally intensive things we might need to do on top of that. I just think it is quite amazing and I would love learn more about how this all works.

sritejavij

A question about continuous probability in general, but if we were to have a problem like the probability of throwing a dart in the exact center of a dartboard, there's technically an infinite number of positions the dart could land in, giving the probability as 0. Yet, hitting the exact center with a low (but not 0) probability is still possible. How does continuous probability/integration help alleviate this issue?

RishSharma7

It's a little off topic, but I figured I would respond to Jay. I also found the random number generation idea fascinating, along with how the seed affects the number generated, and how we can provide a different seed to a random number generator, or the rand/srand function in C++, and get different outputs. Here's a site that I found that goes a bit more in depth about random number generation specifically in C++, if it helps: https://www.simplilearn.com/tutorials/cpp-tutorial/random-number-generator-in-cpp. They do mention that oftentimes, the system time is used as the seed value as it is ever-changing, never the same as the past, and easy to add into code. Cool stuff.

AnikethPrasad

@sritejavij If i'm understanding your question correctly, the probability that a dart actually hits the exact center is so small that 1/inf is accurate representation of the probability. Even though the probability of hitting any specific point is zero, the probability of hitting a range around that point can be non-zero and we can make the range as small as we want to generate an estimate of hitting the center.

ShonenMind

To add on to @AnikethPrasad 's answer, when we are trying to compute an integral, we are essentially adding up an infinite number of infinitesimally small areas (very very thin rectangles). This could give some intuition for why hitting the exact exact EXACT center of a dartboard is technically 0: since there are an uncountably infinite number of possible positions the dart can hit, the possibility of hitting that one center is 0, similar to how randomly choosing, say, 1/2 from the real interval [0,1] is also 0.

However, when we look at INTERVALS - for instance, in a dartboard of radius 1, finding the probability that the dart is within 0.25 from the center - we are able to obtain non-zero probabilities, because we are essentially comparing an uncountably infinite number of values (being with 0.25 from the center) to another uncountably infinite number of values (all the different dartboard positions). This is synonymous with taking an uncountably infinite number of these infinitesimally thin rectangles to form a non-zero area.

charshou

It is interesting to me that in a setting where we are considering continuous probability, we are thinking about an infinite number of possible samples, so that possibility of getting an exact value has to be zero, so we would have to consider a range of values instead.

You must be enrolled in the course to comment