static <A> A oneOf(L<A> l) { return empty(l) ? null : l.get(new Random().nextInt(l.size())); } static char oneOf(S s) { ret empty(s) ? '?' : s.charAt(random(l(s))); } static S oneOf(S... l) { ret oneOf(asList(l)); }
download show line numbers debug dex
Travelled to 9 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, tslmcundralx, tvejysmllsmz
No comments. add comment
Snippet ID: | #1001295 |
Snippet name: | oneOf function |
Eternal ID of this version: | #1001295/4 |
Text MD5: | ad2f75b28f77437b27667286f3e2f737 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-08-13 12:55:40 |
Source code size: | 233 bytes / 11 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 408 / 669 |
Version history: | 3 change(s) |
Referenced in: | [show references] |
Formerly at http://tinybrain.de/1001295 & http://1001295.tinybrain.de