|0.2.0||Aug 27, 2019|
#25 in #prng
Random Number Generators
This is a project demonstrating a range of random number generators allowing a simple comparison of each. This repository consists of two parts, a command line utility which allow the generation of pseudo random numbers using a range of different algorithms. The other component is a talk about how we generate random numbers on a computer.
Installation of Command Line Utility
The command line utility is written in Rust, which can be installed by following the instructions at https://rustup.rs/.
rustup tool has been installed
cargo install random_number_generators
will download and install the binary
in the directory
Alternatively, instead of installing using cargo the repository can be cloned to your local computer using
git clone https://github.com/malramsay64/random_number_generators
which once inside the
cargo run -- --help
will build the binary for your machine,
and run it with the flag
displaying all the options.
The command line tool
The command line tool generates
sequences of random numbers
which are printed to the console (
There are a range of different Pseudo-Random Number Generators (PRNG)
from which to choose from
Each of the different PRNG can be chosen using the first argument.
As an example of use I will generate 10,000 points in 3D space using the RANDU generator which I use to demonstrate how terrible it is.
random_number_generators randu --dimensions 3 --num_samples 10000 --seed 0
This can be saved to a text file for later analysis using redirection
random_number_generators randu --dimensions 3 --num_samples 10000 --seed 0 > randu.txt
A presentation covering what PRNGs are, some of their history and a look at what we currently use.
Installation of Tools
There are a number of tools used in this process and to make it easier they are managed using the conda package manager. This is available as a minimal image in miniconda, with installation instructions available here.
Once conda is installed, running the command
conda env create
will install all the necessary packages
in a virtual environment
which can be accessed using the command
conda activate rng
With the environment activated, the command
will create a file
which contains the presentation.