Clean-code randomness for sequences.

Python code showing that using the same seed value gives the same random numbers
Python code showing that using the same seed value gives the same random numbers

Python is a batteries-included language, meaning it includes many many useful features in the standard library included with your Python installation. One of the handy libraries israndom that offers a few convenient functions for doing pseudo-random things.

Why pseudo-random? Well, computers are pretty much dependent on being told what to do, and you can’t tell them to do something that is actually random. So, instead, they use some very fancy maths to generate a number that is effectively random enough.

If you want to pull back the curtain, you can tinker with setting the seed value. You will find that…


Hello Medium via a GitHub Gist…

Simon Rowland

Software Architect, People Manager and Dog Walker

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store