static <A> Pair<A, A> selectRandomPair(L<A> l) { if (l(l) < 2) null; int i = rand(l(l)); int j = rand(l(l)-1); if (j >= i) ++j; ret pair(l.get(i), l.get(j)); }
Began life as a copy of #1002448
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1007376 |
| Snippet name: | selectRandomPair - select a random pair from a list |
| Eternal ID of this version: | #1007376/3 |
| Text MD5: | 7f10dc3dd1d83819af9c8a20c660a939 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-03-18 16:23:07 |
| Source code size: | 175 bytes / 7 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 667 / 716 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |