Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

5
LINES

< > BotCompany Repo | #1023462 // randomlyChooseFirstList - randomly choose one of two lists according to their sizes

JavaX fragment (include)

sbool randomlyChooseFirstList(Collection a, Collection b) {
  if (empty(b)) true;
  if (empty(a)) false;
  ret random(l(a) + l(b)) < l(a);
}

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: 234 / 271
Version history: 1 change(s)
Referenced in: [show references]