Commit 7311f08
committed
fix!: Improve float()'s distribution (#36)
When a `min` and `max` is given, `float()` tends to stick around the `min`.
This PR changes the implementation to ensure the values distribute more evenly across the (min, max) range of values.
**BREAKING CHANGE**
This is a breaking change. Inputs for `float()` will now map to a different output after upgrading fictional. It is still deterministic, the same input will always map to the same output. It is just that after the upgrade the corresponding output for each input will have changed.
### Before/After
<img width="985" alt="Screenshot 2024-01-02 at 15 12 14" src="https://github.com/oftherivier/fictional/assets/1731223/df64be59-705c-499c-8218-516e20e13855">
### Before on its own
<img width="975" alt="Screenshot 2024-01-02 at 15 13 20" src="https://github.com/oftherivier/fictional/assets/1731223/42de34c1-229d-444a-8593-b461a918619d">
### After on its own
<img width="1003" alt="Screenshot 2024-01-02 at 15 14 04" src="https://github.com/oftherivier/fictional/assets/1731223/b32952ea-09f2-4988-abcd-1b366b05fc1c">
https://gist.github.com/justinvdm/9494ed9ba728de802778832b3c9d640d1 parent a7cbd96 commit 7311f08
File tree
5 files changed
+53
-64
lines changed- tests
- snapshots
- utils/snapshots
5 files changed
+53
-64
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
8 | | - | |
9 | 7 | | |
10 | 8 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
| 9 | + | |
21 | 10 | | |
22 | 11 | | |
23 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
337 | | - | |
| 337 | + | |
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
| |||
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
350 | | - | |
| 350 | + | |
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
| |||
0 commit comments