Along the time time I have put in Bugzilla a good amount of code for Phobos.

In Bugzilla I have an enhancement request that asks to turn std.random.dice 
into a range:
http://d.puremagic.com/issues/show_bug.cgi?id=5849

Through Reddit I have found an efficient O(1) weighted choice:
http://www.keithschwarz.com/darts-dice-coins/

So I have translated the Java code, with small changes, into a D almost-range:
http://codepad.org/Ipp6R3DR
The code contains some questions, some TODOs, and probably a Range mistake too.

Bye,
bearophile

Reply via email to