Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for sample-multinomial with size 1 resulting in ISeq from Double
- Evaluating (stats/sample-multinomial 1) causes the exception java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Double, because sample-uniform returns a sequence if called with a size > 1 and a double otherwise. - This happens because sample-uniform returns a double if called with size=1 and a seq otherwise. The fix is to make sample-uniform always return a seq, even if it just has one element. - There is only one place where sample-uniform is called with size=1 and this commit updates the call. - There are two places where sample-uniform is called with size passed in as a parameter. One call is in a place in sample where it is always true that size>1. The other call is in sample-multinomial and this commit fixes the problem there.
- Loading branch information