Odds — OCaml Dice Dice Something
Odds is an OCaml library for rolling dice. It features deterministic dice rolls and it uses effects in order to leave all PRNG choices to the binary/main rather than embedding it in the library code.
Odds can be installed with
opam install odds
Odds.Dicecontains basic definitions for dice rolling. The code exported by this module only ever perform the
Odds.Dice.Rolleffect and no other side-effect. In particular it does not handle PNRG state: instead, the caller of
evalis responsible for installing an effect handler for
rollis an implementation of a simple dice-roller using the
Oddslibrary. It is mostly intended to be used as an example for how to use
Odds. In particular, how to handle theRoll` effect.
tests/contains tests for the parser (
Odds.Lexer) and the roller (
Odds.Dice.evalfunction). This latter test only checks that the evaluation of a formula performs the expected
Rolleffects, it does not make any assertion on the actual result.
To generate the documentation, use
dune build @doc
To consult online documentation, visit https://raphael-proust.github.io/code/odds/index.html