Skip to content
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

Distributions #32

Open
nvzqz opened this issue May 7, 2017 · 4 comments
Open

Distributions #32

nvzqz opened this issue May 7, 2017 · 4 comments

Comments

@nvzqz
Copy link
Owner

nvzqz commented May 7, 2017

RandomKit should be able to generate random floating-point values with various distributions.

They should:

  • Not add too much compile time
  • Be modular
  • Be fast

Rust's rand crate implements this via separate types.

@nvzqz nvzqz assigned nvzqz and unassigned nvzqz May 7, 2017
@nvzqz
Copy link
Owner Author

nvzqz commented May 7, 2017

@phimage, do you have any implementation suggestions?

@phimage
Copy link
Collaborator

phimage commented May 8, 2017

I am not familiar with rust, packaging, types, etc... but I can read some code
https://github.com/rust-lang-nursery/rand/tree/master/src/distributions
and see mention of zigurat, exponential distrib, etc...

Be fast

There is more than one approximation method to generate number with random distributions

I use polar form of the Box-Muller transformation for gaussian

there is others method like I mention in my code here

(others methods The Ratio method[50], The ziggurat algorithm)

I don`t study this method, but I think ziggurat is faster

Be modular

My implementation #26 was protocol-oriented, like RandomKit

Not add too much compile time

It seems that my implementation add too much compile time for you #29

@nvzqz
Copy link
Owner Author

nvzqz commented May 26, 2017

So one negative thing that struck out to me with the previous implementation was that it added methods to types implementing the distribution protocol that were outside of RandomKit's scope. In order to avoid this, we could have only the methods required for the protocols. Then implement the protocols individually for Double and Float.

@johndpope
Copy link

johndpope commented Jul 6, 2017

There doesn't seem to be any current swift3/4 compilable code that can do Weibull distribution.
https://github.com/aidangomez/RandKit/blob/master/Source/Distributions/Continuous/Weibull.swift

325px-weibull_pdf svg

Eric's implementation seems to come undone with renaming of RandomWithinClosedRange
phimage/RandomDistributionKit#1
his library depends on this library -

it would be neat if this was all self contained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants