mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -05:00
cleanup; use short-paths
This commit is contained in:
parent
ccf605de12
commit
4d9b1d68ed
2 changed files with 5 additions and 5 deletions
2
_tags
2
_tags
|
|
@ -5,4 +5,4 @@
|
|||
<src/core/CCVector.cmx>: inline(25)
|
||||
<src/data/CCFlatHashtbl.cm*> or <src/data/CCHashTrie.cm*> or <src/data/CCPersistent*>: inline(15)
|
||||
<src/**/*.ml> and not <src/misc/*.ml>: warn_A, warn(-4), warn(-44)
|
||||
true: no_alias_deps, safe_string
|
||||
true: no_alias_deps, safe_string, short_paths
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ let _diff_list ~last l =
|
|||
∑_k y_k = ∑_k (x_{k+1} - x_k ) = x_{len} - x_0 = i. *)
|
||||
let split_list i ~len st =
|
||||
if i >= len then
|
||||
let xs = sample_without_replacement (len-1) (int_range 1 @@ i-1) st in
|
||||
let xs = sample_without_replacement (len-1) (int_range 1 (i-1)) st in
|
||||
_diff_list ( 0::xs ) ~last:i
|
||||
else
|
||||
None
|
||||
|
|
@ -198,9 +198,9 @@ let uniformity_test ?(size_hint=10) k rng st =
|
|||
Hashtbl.replace histogram x (n + 1) in
|
||||
let () =
|
||||
for _i = 0 to ( k - 1 ) do
|
||||
add @@ rng st
|
||||
add (rng st)
|
||||
done in
|
||||
let cardinal = float_of_int @@ Hashtbl.length histogram in
|
||||
let cardinal = float_of_int (Hashtbl.length histogram) in
|
||||
let kf = float_of_int k in
|
||||
(* average number of points assuming an uniform distribution *)
|
||||
let average = kf /. cardinal in
|
||||
|
|
@ -211,7 +211,7 @@ let uniformity_test ?(size_hint=10) k rng st =
|
|||
(* Central limit theorem: a confidence interval of 4σ provides a false positive rate
|
||||
of 0.00634% *)
|
||||
let confidence = 4. in
|
||||
let std = confidence *. ( sqrt @@ kf *. variance ) in
|
||||
let std = confidence *. (sqrt (kf *. variance)) in
|
||||
let predicate _key n acc =
|
||||
acc && abs_float (average -. float_of_int n) < std in
|
||||
Hashtbl.fold predicate histogram true
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue