package owl-base

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

Source file owl_base_stats_dist_bernoulli.ml

1
2
3
4
5
6
7
8
9
10
11
# 1 "src/base/stats/owl_base_stats_dist_bernoulli.ml"
(*
 * OWL - an OCaml numerical library for scientific computing
 * Copyright (c) 2016-2018 Liang Wang <liang.wang@cl.cam.ac.uk>
 *)


let bernoulli_rvs ~p =
  assert (p >= 0. && p <= 1.);
  if (Random.float 1.) <= p then 1.
  else 0.