Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

16
LINES

< > BotCompany Repo | #1026892 // intRangeChunks - returns L<IntRange>

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2224L/14K).

1  
static L<IntRange> intRangeChunks(int end, int chunkSize) {
2  
  ret intRangeChunks(0, end, chunkSize);
3  
}
4  
5  
static L<IntRange> intRangeChunks(int start, int end, int chunkSize) {
6  
  new L<IntRange> l;
7  
  int i = start;
8  
  while (i < end) {
9  
    l.add(IntRange(i, min(end, i+chunkSize)));
10  
    i += chunkSize;
11  
  }
12  
  ret l;
13  
}
14  
15  
// gratuitous convenience syntax for processing sound samples
16  
static L<IntRange> intRangeChunks(short[] l, int chunkSize) { ret intRangeChunks(l(l), chunkSize); }

Author comment

Began life as a copy of #1020604

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1026892
Snippet name: intRangeChunks - returns L<IntRange>
Eternal ID of this version: #1026892/3
Text MD5: cd1a12db6d5b1bef2eb274f747cd3ef4
Transpilation MD5: 10072daa2924c20dc47ba2a95bfb59e7
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-02-02 14:55:38
Source code size: 493 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 244 / 332
Version history: 2 change(s)
Referenced in: [show references]