News for hackers. Stuff that matters.
Re:Quant Job Interview Questions (2009) [pdf] by SonOfLilit on Saturday November 12, 2016 @08:41PM (#12941349)
Definitely not 67% of cases, more like 50% + epsilon:

    def round():
        x = random.random()
        if x <= 0.66666:
            x = random.random()
        y = random.random()
        if y <= 0.5:
            y = random.random()
        return x >= y

    sum(round() for _ in xrange(10000000))
    5001450
    sum(round() for _ in xrange(10000000))
    5004434
    sum(round() for _ in xrange(10000000))
    5000238
I also ran a test of 0.6666 vs. 0.625, and... sorry to say, but 0.625 wins hands down.

There are no comments on this comment yet.