Libraryless. Click here for Pure Java version (5070L/28K).
1 | static int[] randomSortedIntArray(int n, Random random default defaultRandomizer()) {
|
2 | new IntBuffer buf; |
3 | for i to n: if (tossCoin(random)) buf.add(i+1); |
4 | ret buf.toArray(); |
5 | } |
download show line numbers debug dex old transpilations
Travelled to 9 computer(s): bhatertpkbcr, iveijnkanddl, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1029032 |
| Snippet name: | randomSortedIntArray - n is max length, can be any shorter length too |
| Eternal ID of this version: | #1029032/7 |
| Text MD5: | 6496c8f6eab0483f27c114915440ce00 |
| Transpilation MD5: | 69f25b34fe9e390dbc1a5a54cd84c425 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2021-12-26 16:14:05 |
| Source code size: | 183 bytes / 5 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 402 / 568 |
| Version history: | 6 change(s) |
| Referenced in: | [show references] |