Open SabrinaJewson opened 2 years ago
I would be careful with returning integers for distributions that use floats internally. For large numbers, this is lossy.
For most the distributions, their implementations effectively use integers anyway and this PR just exposes that functionality.
The only exception is the geometric distribution:
x.log(1.0 - self.p).ceil() as u64
The largest finite value this expression can be is if x = 1.4e-45
and 1.0 - self.p = 0.9999999999999999
, in which case we get 930262250532780300
, which when casted to a u64
is 930262250532780288
. Importantly it does stay within the range of a u64
, so I would say the lossiness is acceptable here.
Very reasonable PR, adding to milestone 0.17 and we'll probably get this merged! Preliminary checks looks good to me.