Affects Version/s: None
Fix Version/s: 3.2
Creating an array with Array.newInstance(singletons.get(0).getClass(), sampleSize) in DiscreteDistribution.sample(int) is risky. An exception will be thrown if:
- singleons.get(0) is of type T1, an sub-class of T, and
- DiscreteDistribution.sample() returns an object which is of type T, but not of type T1.
Attaching a patch.