Transpiled version (4084L) is out of date.
1 | static L<IntRange> splitIntoRandomRanges(double approximateNumberOfRanges, IntRange base) { |
2 | int i = base.start; |
3 | new L<IntRange> out; |
4 | double avgLength = doubleRatio(l(base), approximateNumberOfRanges); |
5 | ifdef splitIntoRandomRanges_debug |
6 | print(+approximateNumberOfRanges, +avgLength, i, lBase := l(base)); |
7 | endifdef |
8 | int safety = 0; |
9 | while (i < base.end && safety++ < l(base)) { |
10 | double randVal = random(avgLength*2); |
11 | int j = min(base.end, i+max(1, iround(randVal))); |
12 | ifdef splitIntoRandomRanges_debug |
13 | print(+randVal, +j); |
14 | endifdef |
15 | out.add(intRange(i, j)); |
16 | i = j; |
17 | } |
18 | ret out; |
19 | } |
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1032922 |
Snippet name: | splitIntoRandomRanges |
Eternal ID of this version: | #1032922/6 |
Text MD5: | b7a9f176a6cfd1287e99286da96a037b |
Author: | stefan |
Category: | javac |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-10-10 23:20:52 |
Source code size: | 639 bytes / 19 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 166 / 235 |
Version history: | 5 change(s) |
Referenced in: | [show references] |