Hacker News new | ask | show | jobs
by tmoertel 407 days ago
A while ago I tried to create a more self-explanatory implementation:

https://github.com/tmoertel/practice/blob/master/libraries%2...

It is limited to integer weights only to make it easy to verify that the algorithm implements the requested distribution exactly. (See the test file in the same directory.)

1 comments

You could probably restrict to rational numbers, and still verify? Languages like Python, Haskell, Rust etc have good support for arbitrary length rational numbers.

Each floating point number is also a rational number, and thus you could then restrict again to floating point afterwards.