Ad
  • Custom User Avatar

    not not id(object())//3%2

    btw, I'm aware this isn't at all random, my initial version of this was an instance of malicious compliance with the tests. In fact, you can make this method perform hilariously badly:

    In [1]: d = {True: 0, False: 0}

    In [2]: for _ in range(1000000): d[not not id(object())//3%2] += 1

    In [3]: d
    Out[3]: {True: 0, False: 1000000}

    In [4]: for _ in range(1000000): d[not not id(object())//3%2] += 1

    In [5]: d
    Out[5]: {True: 0, False: 2000000}

    In [6]: for _ in range(1000000): d[not not id(object())//3%2] += 1

    In [7]: d
    Out[7]: {True: 1000000, False: 2000000}