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

3
LINES

< > BotCompany Repo | #1024040 // takeRandom - take n random elements of list (all different)

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (1949L/12K).

static <A> L<A> takeRandom(int n, L<A> l) {
  ret takeFirst(n, shuffledIterator(l));
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, whxojlpjdney

No comments. add comment

Snippet ID: #1024040
Snippet name: takeRandom - take n random elements of list (all different)
Eternal ID of this version: #1024040/2
Text MD5: ddbc1891ffa659bc25c49a00205d9757
Transpilation MD5: 54151a44c16ecfaccbb79a0060d7f85e
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-18 13:52:58
Source code size: 88 bytes / 3 lines
Pitched / IR pitched: No / No
Views / Downloads: 225 / 319
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)