Transpiled version (4084L) is out of date.
static L<IntRange> splitIntoRandomRanges(double approximateNumberOfRanges, IntRange base) { int i = base.start; new L<IntRange> out; double avgLength = doubleRatio(l(base), approximateNumberOfRanges); ifdef splitIntoRandomRanges_debug print(+approximateNumberOfRanges, +avgLength, i, lBase := l(base)); endifdef int safety = 0; while (i < base.end && safety++ < l(base)) { double randVal = random(avgLength*2); int j = min(base.end, i+max(1, iround(randVal))); ifdef splitIntoRandomRanges_debug print(+randVal, +j); endifdef out.add(intRange(i, j)); i = j; } ret out; }
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: | 396 / 503 |
| Version history: | 5 change(s) |
| Referenced in: | [show references] |