-
-
Notifications
You must be signed in to change notification settings - Fork 444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Poisson distribution to generate integers (not floats) #1497
Comments
Supporting an additional type potentially breaks type inference, but I don't think this is a big concern (but this does require a breaking release). I suggest that we support |
Not to be too picky, but I figured I would point out the typo in the issue title, since "poison distribution" sounds a bit dangerous. :p |
In this case a big λ would lead to this sampling only I think we should implement only |
This addresses rust-random#1497 by adding `Distribution<u64>` It also solves rust-random#1312 by not allowing `lambda` bigger than `1.844e19` (this also makes them always fit into `u64`)
This addresses rust-random/rand#1497 by adding `Distribution<u64>` It also solves rust-random/rand#1312 by not allowing `lambda` bigger than `1.844e19` (this also makes them always fit into `u64`)
Background
What is your motivation?
I would like to use simulate a stochastic process where the number of events in each time window follows a Poisson distribution.
This code fails because the
poisson.sample()
distribution can only return a floatI can fix this by rounding off the float, but my code would be prettier if
poisson.sample()
could return an integer :-)What type of application is this? (E.g. cryptography, game, numerical simulation)
Numerical simulation of a spin-system similar to the Ising model.
Feature request
Introduce a version of the Poisson distribution that implements
Distribution<u64>
orDistribution<i64>
See also https://rust-random.github.io/rand/src/rand_distr/poisson.rs.html#118-180
The text was updated successfully, but these errors were encountered: