[OT] Generating distribution of N dice rolls
H. S. Teoh
hsteoh at qfbox.info
Fri Nov 11 01:47:54 UTC 2022
On Thu, Nov 10, 2022 at 05:27:07PM -0800, H. S. Teoh via Digitalmars-d wrote:
[...]
> /**
> * Simulates rolling N k-sided dice.
> *
> * Returns: A static array representing how many of each of 1..(k+1) were
> * obtained by the rolls.
> *
> * Bugs: The current implementation uses a naïve algorithm that's rather
> * inefficient for large N. For our purposes, though, which involve only
> * relatively small N, this is Good Enough(tm) for the time being. We can look
> * into improving this if it becomes a performance bottleneck.
> */
[...]
Argh, that last paragraph should be deleted. :-(
See, this is proof that documentation goes out of sync with the code.
We need a new innovation, along the lines of built-in unittests, to
revolutionize keeping docs up-to-date with the code.
T
--
The best compiler is between your ears. -- Michael Abrash
More information about the Digitalmars-d
mailing list