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

4
LINES

< > BotCompany Repo | #1014941 // replaceRandomElement

JavaX fragment (include)

1  
static <A> void replaceRandomElement(L<A> l, A newElement) {
2  
  if (empty(l)) ret;
3  
  l.set(random(l(l)), newElement);
4  
}

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: #1014941
Snippet name: replaceRandomElement
Eternal ID of this version: #1014941/1
Text MD5: 64f8e141ccf6ab28197a4f7f06fdb648
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-06 16:45:10
Source code size: 121 bytes / 4 lines
Pitched / IR pitched: No / No
Views / Downloads: 457 / 494
Referenced in: [show references]