0 minutes
Contact me

Last time I looked at how Normal Distrobution 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.

cactus

We might create a function like this:

code

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.