Hacker News new | ask | show | jobs
by dstyrb 3850 days ago
My solution was R=0 always.

So if A is positive, always guess B < A. If A is negative, guess B > A.

Does this not work?

    import numpy as np
    import random as rnd

    trials, correct = 100000000, 0
    for i in range(trials):

        a = rnd.random()-0.5
        b = rnd.random()-0.5

        if a >= 0. and b < a:
            correct+=1
        if a < 0. and b > a:
            correct+=1

    if correct > trials/2.:
        print 'winner: '+str(correct)
1 comments

You're picking a number over the unit interval, not an 'arbitrary number'.
how can I generalize? edit: Oh I see that's what the whole discussion here is about -_-