Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use exponential #492

Merged
merged 2 commits into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Next release

- #492: Also use the new, upstreamed `Gen.exponential` combinator in STM
- #491: Require `qcheck.0.23`, simplify show functions by utilizing it, and update
expect outputs accordingly
- #486: Add `Util.Pp.pp_fun_` printer for generated `QCheck.fun_` functions
Expand Down
6 changes: 1 addition & 5 deletions lib/STM.ml
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,9 @@ struct

let gen_cmds_size gen s size_gen = Gen.sized_size size_gen (gen_cmds gen s)

let exp_dist_gen mean =
let unit_gen = Gen.float_bound_inclusive 1.0 in
Gen.map (fun p -> -. mean *. (log p)) unit_gen

let cmd_list_size_dist mean =
let skew = 0.75 in (* to avoid too many empty cmd lists *)
Gen.map (fun p -> int_of_float (p +. skew)) (exp_dist_gen mean)
Gen.map (fun p -> int_of_float (p +. skew)) (Gen.exponential mean)

let arb_cmds s =
let mean = 10. in (* generate on average ~10 cmds, ignoring skew *)
Expand Down
Loading