(final T[] source)
| 111 | } |
| 112 | |
| 113 | public static final <T> T random(final T[] source) { |
| 114 | if (source == null) { return null; } |
| 115 | |
| 116 | switch (source.length) { |
| 117 | case 0: return null; |
| 118 | case 1: return source[0]; |
| 119 | default: return source[MyRandom.getRandom().nextInt(source.length)]; |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | // Random - algorithm adapted from Braid's GeneratorFunctions |
| 124 | /** |