package urn

  1. Overview
  2. Docs
Urn data structure for fast pure functional random sampling

Install

Dune Dependency

Authors

Maintainers

Sources

20231124.tar.gz
md5=51102864138dbf2859a15c680a18e566
sha512=64d80d5a772d930c20bf6e2eae4127c858e59cb192dba36b9022a64746bda594631f7c631a2fcdd53c077ed930f92990791783d4d60128a5ccf2be110444fa83

doc/urn/Urn/module-type-WeightType/index.html

Module type Urn.WeightTypeSource

Input signature of the functor Make.

Sourcetype t

The type of weights.

Sourceval compare : t -> t -> int

A total ordering function over weights. compare x y should return zero if the weights x and y are equal, compare x y should be negative if x is less than y, and compare x y should be positive if x is greater than y.

Sourceval zero : t

Weight zero value. It should be the case that forall x, add x zero = x.

Sourceval add : t -> t -> t

Weight addition. Should be commutative, associative, etc.

Sourceval sub : t -> t -> t

Weight subtraction. It should be the inverse of add, i.e. forall x and y, sub (add x y) y equals x.

Sourceval sample : t -> t

Weight sampling function. sample w should produce a value uniformly chosen between zero (inclusive) and w (exclusive). Example: Random.int is a suitable sampling function for integer weights.

OCaml

Innovation. Community. Security.