brnstz / prob

Probability experiments in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

prob

Probability experiments in Go

GoDoc Build Status

Requirements

  • Go 1.6+

Example

package main

import (
    "fmt"
    "math/big"

    "github.com/brnstz/prob"
)

func main() {
    // There are 100 restaurants in a city. A restaurant reviewer wants to
    // eat dinner at a different restaurant every night in a week. How many
    // different possible dining schedules could he have?
    var (
        restaurants int64 = 100
        days        int64 = 7
    )

    schedules := prob.NoReplaceOrdered(big.NewInt(restaurants), big.NewInt(days))

    fmt.Printf(
        "There are %s different ways to schedule dinner.",
        schedules.Text(10),
    )

}

About

Probability experiments in Go

License:MIT License


Languages

Language:Go 100.0%