I am looking for the best way (fast and elegant) to get a random boolean in python (flip a coin).
For the moment I am using random.randint(0, 1) or
random.randint(0, 1)
If you want to generate a number of random booleans you could use numpy's random module. From the documentation
np.random.randint(2, size=10)
will return 10 random uniform integers in the open interval [0,2). The size keyword specifies the number of values to generate.
size