31 January 2018, 18:09

# custom distribution : controlling the random

Last time I looked at how Normal Distribution can make make random numbers consistently closer to the mean.

Let's customize the distribution a little.

Back to cacti, say we wanted to model a mature group of cacti that are all very tall.

We might create a function like this:

We would just push the first number if we wanted to model younger smaller cacti.

Here is a quick chart showing accumulated total of the two generated data sets:

See the Pen Custom Distribution by Adam Harpur (@harps116) on CodePen.

As you can see the tall biased set contains significantly larger numbers than the smaller biased set.

Happy Coding!

Check out Daniel Shiffman's great series on the Nature of Code, this 100 days of learning is a great excuse for me to finally work through the lessons and take some notes as I go.