1 | static <A> Pair<A, A> selectRandomPair(L<A> l) { |
2 | if (l(l) < 2) null; |
3 | int i = rand(l(l)); |
4 | int j = rand(l(l)-1); |
5 | if (j >= i) ++j; |
6 | ret pair(l.get(i), l.get(j)); |
7 | } |
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: | 465 / 499 |
Version history: | 2 change(s) |
Referenced in: | [show references] |