fast-loaded-dice-roller
fast-loaded-dice-roller copied to clipboard
A near-optimal exact sampler for discrete probability distributions
https://github.com/probsys/fast-loaded-dice-roller/blob/19d30abe421edecf25173ca4146f02109194be5f/src/c/flip.c#L14-L25 `rand()` returns a random 31-bit integer packed into a 32-bit integer (whose sign bit is always zero). The positions of the extracted bits should then be 0, ..., 30....
See the analysis in https://issues.apache.org/jira/browse/RNG-179
1. Remove initialization of H to -1; instead, use calloc for initalizatio nto 0 and index the samples by 1, ..., n+1; also make sure to update the sampler to...
While writing a [code generator](http://peteroupc.github.io/autodist.html) based on the Fast Loaded Dice Roller, I've noticed that two equivalent sets of integer weights (where one is an integer multiple of the other)...