-
Notifications
You must be signed in to change notification settings - Fork 44
Description
As part of discussing "The Great Renaming" ™️ offline, @c-cube and I agreed to revise the default sizes used in our
list, array, string, bytes, ... generators.
Currently, these tend to use nat which has a terrible distribution:
qcheck/test/core/QCheck_expect_test.expected.ocaml5.64
Lines 1513 to 1536 in 1aa167f
| +++ Stats for nat dist ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
| stats dist: | |
| num: 1000, avg: 382.03, stddev: 1290.55, median 9, min 0, max 9890 | |
| 0.. 494: ####################################################### 850 | |
| 495.. 989: ###### 93 | |
| 990..1484: 8 | |
| 1485..1979: 3 | |
| 1980..2474: 7 | |
| 2475..2969: 1 | |
| 2970..3464: 3 | |
| 3465..3959: 3 | |
| 3960..4454: 3 | |
| 4455..4949: 4 | |
| 4950..5444: 3 | |
| 5445..5939: 3 | |
| 5940..6434: 3 | |
| 6435..6929: 1 | |
| 6930..7424: 2 | |
| 7425..7919: 1 | |
| 7920..8414: 1 | |
| 8415..8909: 5 | |
| 8910..9404: 3 | |
| 9405..9899: 3 |
Before the 1.0.0 release we should revise these to have a nicely curved (and more predictable) distribution, e.g., based on exponential/float_exp with a reasonable mean parameter:
qcheck/test/core/QCheck_expect_test.expected.ocaml5.64
Lines 1828 to 1851 in 1aa167f
| +++ Stats for exponential 10. dist ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
| stats dist: | |
| num: 5000, avg: 9.45, stddev: 9.82, median 6, min 0, max 79 | |
| 0.. 3: ####################################################### 1631 | |
| 4.. 7: ##################################### 1109 | |
| 8..11: ######################### 747 | |
| 12..15: ################# 512 | |
| 16..19: ########## 308 | |
| 20..23: ######## 251 | |
| 24..27: ##### 165 | |
| 28..31: ## 85 | |
| 32..35: ## 64 | |
| 36..39: # 43 | |
| 40..43: 25 | |
| 44..47: 20 | |
| 48..51: 20 | |
| 52..55: 3 | |
| 56..59: 8 | |
| 60..63: 3 | |
| 64..67: 1 | |
| 68..71: 2 | |
| 72..75: 2 | |
| 76..79: 1 |
In the qcheck-STM library we already do so (adding a bit of skew to avoid generating too many identical 0-length lists):
https://github.com/ocaml-multicore/multicoretests/blob/b5be1fe48bef28a1bbe604d59b322918624f987f/lib/STM.ml#L175-L180