[OT] Algorithm question
MysticZach via Digitalmars-d
digitalmars-d at puremagic.com
Thu May 4 06:28:21 PDT 2017
On Thursday, 4 May 2017 at 13:19:43 UTC, MysticZach wrote:
> On Thursday, 4 May 2017 at 08:04:22 UTC, Timon Gehr wrote:
>> On 03.05.2017 01:09, MysticZach wrote:
>>> That's true. Two points, though: If the range of error is
>>> within
>>> 1/(n*(n-1)), with array length n,
>>
>> It's not though. For example, [1,1,1,0,...,0] (length 29), you
>> get 0 and 2 each with probability 43/116, but 1 only with
>> probability 30/116.
>>
>> It might be interesting to figure out how far from uniform the
>> distribution can get.
>
> Or how close it can get, depending on the range of intervals
> used. My math skill is shaky here.
>
> Maybe there's no way to deterministically jump to every element
> of an array with equal probability of hitting any given element
> satisfying a given predicate first. It sure would be cool if
> there were.
Within a small range of error, I mean.
More information about the Digitalmars-d
mailing list