The nature of randomness (I.)

Source: Internet
Author: User
Tags value of pi

Random numbers will always be used in computer science. My intention was to manage the frequent use of random numbers in Monte Carlo simulations. The data space of the domain is quite large enough to test all the possibilities in detail, so that I can look at random input parameter assignments in the simulation and produce massive output results that can be verified with many static methods. For example, you can calculate PI values using random numbers as described above. (Note: The Monte Carlo method is a method of solving many computational problems using random numbers) [If you don't know if you can do the calculations using the above method, you need to take a few minutes to think about it.] There are many interesting ways on the web. Which even includes throwing darts! The link below will help you calculate the random number in your browser, and the link will also include a JS sample. Sample link: https://curiosity-driven.org/pi-approximation] Once you understand (or try to read other simple methods), this method seems to you to be elegant and reasonable. But it also has a potential flaw, which is that it relies heavily on the true randomness of the numbers used to generate Monte Carlo test elements. The algorithm predicts the generation of random numbers to have a uniform probability distribution. If you are generating random floating-point numbers between 0.0~1.0, the probability that any one number will appear must be the same as the other numbers. If the probability of a number near 0.5 is slightly higher than the other number, then you will end up with a bias that will bias the wrong answer. In the JS sample I mentioned, it is easy to find that more points fall in the circle, because the number of points indicates the circle area in which it is located, and the ratio of the circle area to the square is also too large. So the computer calculates the PI value also to be too big. [There is one more question to consider when considering the uniformity of distribution: How big is your sample size? Sample distribution evenly is the first half and the second half is uniform? If you run a JS script, you may find it interesting to observe that the value of pi is constantly changing. Maybe the JS random number generator is not perfect? The random numbers are not only absolutely unordered, but they are guaranteed to occur so that any Monte Carlo simulation can function properly. The majority of random number generators that are attached are not really random, regardless of which computer language you are using. They are deterministic algorithms. The random function we use usually refers to a pseudo-random number generator. They are designed to properly generate uniformly distributed irregular numbers. But is that enough? I'll explain it in the next article. Reference: After 12 hours of Monte Carlo simulation, the PI is valued at 3.14154XXXXXX.

Is this deviation acceptable? If you add another 12 hours, will the answer be better? These are the random questions that everyone needs to think about. Note: This article is a translation. Original link: https://dzone.com/articles/the-randomness-of-being

The nature of randomness (I.)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.