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

4
LINES

< > BotCompany Repo | #1002145 // randomOne - return random element of a list

JavaX fragment (include)

1  
static <A> A randomOne(L<A> l) {
2  
  if (empty(l)) ret null;
3  
  ret l.get(random(l(l)));
4  
}

Author comment

Began life as a copy of #1002033

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: #1002145
Snippet name: randomOne - return random element of a list
Eternal ID of this version: #1002145/1
Text MD5: ffe136fa05b441e181b1c9a64fe1a85b
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-12-21 23:55:36
Source code size: 90 bytes / 4 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 689 / 984
Referenced in: [show references]