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

5
LINES

< > BotCompany Repo | #1027462 // randomNGram

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

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

1  
sS randomNGram(int n, S s) {
2  
  if (l(s) < n) null;
3  
  int i = random(l(s)-n+1);
4  
  ret substring(s, i, i+n);
5  
}

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: #1027462
Snippet name: randomNGram
Eternal ID of this version: #1027462/1
Text MD5: d7edc9d77349270e960422f8ecd3efaa
Transpilation MD5: 4c503e2453ddb08e20303cbd1127405b
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-03-22 13:05:01
Source code size: 112 bytes / 5 lines
Pitched / IR pitched: No / No
Views / Downloads: 187 / 274
Referenced in: [show references]