package owl

  1. Overview
  2. Docs

Rnd module is for generating random variables of various distributions.

Please refer to GSL documentation for details.

Continuous random variables
val flat : float -> float -> float

flat a b draws a random number from the interval [a,b) with a uniform distribution.

val uniform : unit -> float

uniform returns a random float number within [0,1), including 0 but excluding 1. uniform () is equivalent to flat 0. 1.

val gaussian : ?sigma:float -> unit -> float

gaussian ~sigma:s () returns the value of a random variable that follows Normal distribution of sigma = s.

val gaussian_tail : float -> float -> float

gaussian_tail a x sigma returns a random value of a gaussian tail distribution. note "a" must be positive.

val bivariate_gaussian : float -> float -> float -> float * float

bivariate_gaussian sigma_x sigma_y rho returns a pair of correlated gaussian variates, with mean zero, correlation coefficient rho -1, 1 and standard deviations sigma_x and sigma_y in the x and y directions.

val exponential : float -> float

exponential mu return a random value that follows exponential distribution.

val laplace : float -> float
val exppow : float -> float -> float
val cauchy : float -> float
val rayleigh : float -> float
val landau : unit -> float
val levy : float -> float -> float
val levy_skew : float -> float -> float -> float
val gamma : float -> float -> float
val lognormal : float -> float -> float
val chisq : float -> float
val dirichlet : float array -> float array -> unit
val fdist : float -> float -> float
val tdist : float -> float
val beta : float -> float -> float
val logistic : float -> float
val pareto : float -> float -> float
val dir_2d : unit -> float * float
val dir_2d_trig_method : unit -> float * float
val dir_3d : unit -> float * float * float
val dir_nd : int -> float array
val weibull : float -> float -> float
val gumbel1 : float -> float -> float
val gumbel2 : float -> float -> float
Discrete random variables
val uniform_int : ?a:int -> ?b:int -> unit -> int

uniform_int a b returns a random int between a and b inclusive, i.e., a random int in a, b

val poisson : float -> int
val bernoulli : float -> int
val binomial : float -> int -> int
val multinomial : int -> float array -> int array
val negative_binomial : float -> float -> int
val pascal : float -> int -> int
val geometric : float -> int
val hypergeometric : int -> int -> int -> int
val logarithmic : float -> int
OCaml

Innovation. Community. Security.