Posts

Showing posts from 2018

Thoughts on Random Number Generators

Image
One of the first exercises given to me as a mathematics student was to write a random number generator (RNG). This turned out to be not so easy. Test sequences cycled quickly or were too predictable or were not evenly distributed. Typically when we talk of RNG’s we are describing pseudorandom number generators. Nowadays, we have a many programs that will generate pseudorandom numbers. Where are random numbers used? As a developer they were rarely required. Recently, however we’ve seen them appear in more and more places - it seems they are  everywhere ! In DevOps, I’ve used RNG’s for creating message payloads of arbitrary size, and for file or directory names. These values are often created using scripts written in  bash . This first article will explore three simple RNG’s that can be run from bash. It is not an exhaustive list, as there are others such as  jot  that is also easy to use from bash. However, the three described here are likely to already be inst...