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

3
LINES

< > BotCompany Repo | #1008666 // getRandomPercent2 - get a percentage of list (randomly chosen), also return rest

JavaX fragment (include)

static <A> Pair<L<A>> getRandomPercent2(L<A> l, double percent) {
  ret selectRandom2(l, max(0, min(l(l), iround(percent/100*l(l)))));
}

Author comment

Began life as a copy of #1008661

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: #1008666
Snippet name: getRandomPercent2 - get a percentage of list (randomly chosen), also return rest
Eternal ID of this version: #1008666/3
Text MD5: 47424bac1e93a1e8bf7d7371bb9fa7c3
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-05-27 14:03:56
Source code size: 138 bytes / 3 lines
Pitched / IR pitched: No / No
Views / Downloads: 469 / 492
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)