package owl-base

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file owl_base_stats_dist_exponential.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 1 "src/base/stats/owl_base_stats_dist_exponential.ml"
(*
 * OWL - OCaml Scientific and Engineering Computing
 * Copyright (c) 2016-2020 Liang Wang <liang.wang@cl.cam.ac.uk>
 *)

let std_exponential_rvs () =
  let u = Random.float 1. in
  -.log1p (-.u)


let exponential_rvs ~lambda =
  let u = Random.float 1. in
  let s = -1. /. lambda in
  s *. log1p (-.u)
OCaml

Innovation. Community. Security.