Writing and Checking a Random Number Generator

This semester, I am taking the following classes; 2.003, 2.60, 6.041, 22.02, and 17.399.

In layman's terms: Dynamics and Controls, Advanced Energy Conversions, Probability Analysis, Applied Nuclear Physics, and Global Energy Markets.

6.041 is focused on probabilistic systems analysis. Under the Electrical Engineering and Computer Science department, the material covered is foundational to many engineering and mathematical disciplines.

Fig. 1 A histogram created from the results in the RNG I wrote in python. Link

Typically, checking the mean of a distribution is the first step towards checking random generation. The mean should sit close to the median of the data (about 4.5 in an even set). This is because the distribution should follow the Discrete Uniform Probability Law.


From Wikipedia: https://en.wikipedia.org/wiki/Random_number_generation

A random number generator (RNG) is a device that generates a sequence of numbers or symbols that cannot be reasonably predicted better than by a random chance. Random number generators can be true hardware random-number generators (HRNG), which generate genuinely random numbers, or pseudo-random number generators (PRNG) which generate numbers which look random, but are actually deterministic, and can be reproduced if the state of the PRNG is known.
Various applications of randomness have led to the development of several different methods for generating random data, of which some have existed since ancient times, among whose ranks are well-known "classic" examples, including the rolling of dice, coin flipping, the shuffling of playing cards, the use of yarrow stalks (for divination) in the I Ching, as well as countless other techniques. Because of the mechanical nature of these techniques, generating large numbers of sufficiently random numbers (important in statistics) required a lot of work and/or time. Thus, results would sometimes be collected and distributed as random number tables.
Several computational methods for pseudo-random number generation exist. All fall short of the goal of true randomness, although they may meet, with varying success, some of the statistical tests for randomness intended to measure how unpredictable their results are (that is, to what degree their patterns are discernible). This generally makes them unusable for applications such as cryptography. However, carefully designed cryptographically secure pseudo-random number generators (CSPRNG) also exist, with special features specifically designed for use in cryptography.

No comments:

Post a Comment

Leap Year Benefits

  People don't talk enough about leap day. It's a completely different experience than most days. Because of that added day, sunsets...