[OT] Generating distribution of N dice rolls
Max Haughton
maxhaton at gmail.com
Fri Nov 11 03:34:31 UTC 2022
On Friday, 11 November 2022 at 01:47:54 UTC, H. S. Teoh wrote:
> 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
Built in AI model? (I joke but this is probably the future,
whoever gets it right will make a lot of money).
Describing what code *does* is actually already relatively doable
using contemporary AI techniques, but that isn't documentation
(or at least isn't good documentation, I don't know that `x + y`
adds two numbers together.
More information about the Digitalmars-d
mailing list