Last active
December 20, 2018 02:31
-
-
Save thomasnield/0d8065d3b85ad83b88185e5b4e429867 to your computer and use it in GitHub Desktop.
Binomial Distribution ojAlgo Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.ojalgo.random.Binomial | |
| fun main(args: Array<String>) { | |
| // I have a 6-sided fair dice | |
| // what is the probability I will roll 3 sixes out of 10 trials? | |
| val probabilityOfSide = 1.0 / 6.0 | |
| Binomial(10, probabilityOfSide).apply { | |
| println(getProbability(3)) // prints 0.15504535957425192 | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment