Libraryless. Click here for Pure Java version (2562L/16K).
1 | sS randomSubstring(S s, int minLength, int maxLength, Random randomizer default defaultRandomizer()) {
|
2 | int len = random_incl(minLength, maxLength, randomizer); |
3 | int i = random(l(s)-len, randomizer); |
4 | ret substring(s, i, i+len); |
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: | #1029314 |
| Snippet name: | randomSubstring |
| Eternal ID of this version: | #1029314/2 |
| Text MD5: | ff23b0e0d9abfcf2c1dd400da1a9a588 |
| Transpilation MD5: | 2b4514afec62b9335ef9097b114af37a |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-07-30 20:04:04 |
| Source code size: | 237 bytes / 5 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 432 / 579 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |