package odds

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type Stdlib.Effect.t +=
  1. | Roll : int -> int Stdlib.Effect.t

The Odds library never handles Randomness. Instead, it is up to the user of the library to install a handler for this Roll faces effect, continuing with a random number from 1 to faces inclusive.

val fold : ('a -> int -> 'a) -> 'a -> int -> int -> 'a

fold f init rolls faces folds f over rolls rolls of a faces-faced die starting with init.

E.g., fold max 0 2 20 takes the best of two d20 rolls.

type unop =
  1. | Neg
type binop =
  1. | Add
  2. | Sub
  3. | Mul
  4. | Div
  5. | Max
  6. | Min
type formula =
  1. | Constant of int
  2. | Dice of int * int
  3. | Binop of binop * formula * formula
  4. | Unop of unop * formula
val eval : formula -> int
OCaml

Innovation. Community. Security.