Day 4 ~ Custom Distribution : Controlling the Random
Day 4
This my fourth post on the 100 days of learning
challenge I set myself.You can read more about this years goals here.
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.
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:
You can view the code behind the chart in the link below:
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.