Skip to content

Instantly share code, notes, and snippets.

@thomasnield
Last active December 20, 2018 02:31
Show Gist options
  • Select an option

  • Save thomasnield/0d8065d3b85ad83b88185e5b4e429867 to your computer and use it in GitHub Desktop.

Select an option

Save thomasnield/0d8065d3b85ad83b88185e5b4e429867 to your computer and use it in GitHub Desktop.
Binomial Distribution ojAlgo Example
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