1 | sbool randomlyChooseFirstList(Collection a, Collection b) { |
2 | if (empty(b)) true; |
3 | if (empty(a)) false; |
4 | ret random(l(a) + l(b)) < l(a); |
5 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1023462 |
Snippet name: | randomlyChooseFirstList - randomly choose one of two lists according to their sizes |
Eternal ID of this version: | #1023462/2 |
Text MD5: | bfccd5653a4dee2c8ebc56cfa7daa370 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-06-22 22:32:26 |
Source code size: | 144 bytes / 5 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 236 / 274 |
Version history: | 1 change(s) |
Referenced in: | [show references] |