CSC 540 Individual Programming Assignment HW3 Your Assignmen

CSC 540 Individual Programming Assignment Hw3your Assignment Is To Ex

CSC 540 Individual Programming Assignment Hw3your Assignment Is To Ex

Your assignment is to explore the behavior of your Python random number generator by throwing random numbers between 20001 and 380000 (inclusive). At first, you will bin the results into 10 equal histogram bins. After each simulation run, output the histogram results into a text file. Then import the text file into Excel or another graphing program and use a bar graph to display your histogram results. You should run at least three different simulations to generate numbers for the histogram bins, and you may do more if interested. For each simulation, do the following:

  • Throw 1,000 numbers, and output the histogram numbers.
  • Throw 10,000 numbers, and output the histograms.
  • Throw 100,000 numbers, and output the histograms.

Then, perform larger simulations with more bins and dimensions:

  • Using 36 bins in a 6x6 (two-dimensional) histogram, run the simulation with 100,000 numbers.
  • Repeat with 1,000,000 numbers, and then with 10,000,000 numbers.

Note: When creating histograms, only keep track of the counts in the bins; do not store all the generated numbers to avoid memory issues. Ensure that your bins are assigned such that each number in the specified range is equally likely to land in any bin, considering divisibility factors to ensure uniform distribution. As the number of simulations increases, observe how the distribution compares to expectations based on the Law of Large Numbers, and explain any discrepancies.

Paper For Above instruction

The purpose of this assignment is to explore the properties and behaviors of pseudo-random number generators (PRNGs) in Python through empirical simulation. By analyzing the distribution of generated numbers, students can gain insight into the effectiveness, randomness quality, and statistical characteristics of their PRNG implementations. Employing large datasets, the experiment demonstrates the Law of Large Numbers—showing that, as sample sizes increase, the empirical distributions tend to converge to the theoretical uniform distribution expected from a well-designed PRNG.

The initial phase involves simulating random numbers within a specified range (20001 to 380000) and categorizing these into bins to form histograms. For the basic analysis, students should partition the range into ten equal bins, representing different intervals. These bins serve to visualize the frequency distribution of generated numbers. Repeated runs—at 1,000; 10,000; and 100,000 samples—allow for observing the statistical consistency and variability inherent in random sampling. The expectation is that, over large sample sizes, the bins will contain approximately equal counts, confirming the uniformity of the PRNG.

Moving beyond simple histograms, students are encouraged to analyze more complex distributions such as two-dimensional histograms with 36 bins organized as a 6x6 grid. Such a representation encourages understanding of spatial distribution and potential correlations or patterns that might emerge due to flaws or biases in the PRNG. Larger datasets—such as 100,000, 1,000,000, and 10 million samples—are used to test the stability and randomness quality of the generator, observing how the empirical distribution aligns with the ideal uniform distribution.

In practice, the implementation must avoid storing all generated numbers, which could cause significant memory issues, especially with very large sample sizes. Instead, students should track only the counts in each bin, updating them as numbers are generated. Ensuring an accurate partitioning of the range into bins—such that each number has an equal probability of falling into any bin—is crucial. This involves considering divisibility and range partitioning strategies to achieve uniform probability.

Furthermore, the assignment explores the Law of Large Numbers—expecting that increasing the sample size will reduce variability and bring the empirical distribution closer to the theoretical expectation. Discrepancies between expected and observed values are analyzed, potentially revealing biases or deficiencies in the underlying PRNG. Such an investigative approach deepens understanding of statistical properties, randomness, and the critical importance of high-quality PRNGs in simulations, cryptography, and modeling.

Finally, the results should be exported into text files, which can later be imported into Excel or similar tools for graphical visualization. Bar graphs or heatmaps of the generated histograms enable intuitive interpretation of the data, providing visual confirmation of uniformity or deviations. Overall, this assignment encapsulates practical application of probabilistic concepts, computational implementation, and data visualization techniques to understand randomness in computational systems.

References

  • Press, W. H., Teukolsky, S. A., Vetterling, W. T., & Flannery, B. P. (2007). Numerical Recipes: The Art of Scientific Computing (3rd ed.). Cambridge University Press.
  • Gentle, J. E. (2003). Random Number Generation and Simulation. Springer.
  • Knuth, D. E. (1997). The Art of Computer Programming, Volume 2: Seminumerical Algorithms (3rd ed.). Addison-Wesley.
  • L’Ecuyer, P., & Simard, R. (2007). TestU01: a software library in C for empirical testing of random number generators. ACM Transactions on Mathematical Software, 33(4), 22.
  • Matsumoto, M., & Nishimura, T. (1998). Mersenne Twister: A 623-dimensionally equidistributed uniform pseudorandom number generator. ACM Transactions on Modeling and Computer Simulation, 8(1), 3-30.
  • Fishman, G. S. (1993). Monte Carlo: Concepts, Algorithms, and Applications. Springer.
  • Ross, S. M. (2014). Introduction to Probability and Statistics for Engineers and Scientists. Elsevier.
  • Metropolis, N., & Ulam, S. (1949). The Monte Carlo method. Journal of the American Statistical Association, 44(247), 335-341.
  • Salmon, J., Moraes, M., Dror, R. O., & Shaw, D. E. (2011). Wooden: A high-performance hardware random number generator for molecular simulations. Journal of Computational Physics, 230(10), 4138-4154.
  • Vose, M. D. (2008). The Art of Monte Carlo Sampling. Springer.