# random boolean python

`bool(random.getrandbits(1)) #is still about twice as fast as random.choice([True, False])`

Here is what the above code is Doing:
1. It’s creating a random number between 0 and 1.
2. It’s converting that number to a boolean.
3. It’s returning that boolean.

The reason this is faster than random.choice([True, False]) is because random.choice() is creating a list of two items, and then choosing one of those items. This is a lot of work for something that can be done in one line.

The reason this is faster than random.randint(0, 1) is because random.randint() is creating a random integer between 0 and 1, and then converting that integer to a boolean. This is a lot of work for something that can be done in one line.

The reason this is faster than random.random() is because random.random() is creating a random number between 0 and 1, and then converting that number to a boolean. This is a lot of work for something that can be done in one line.

The reason this is faster than random.uniform(0, 1) is because random.uniform() is creating a random number between 0 and 1, and then converting that number to a boolean. This is a lot of work for something that can be done in one line.

The reason this is faster than random.getrandbits(1) is because random.getrandbits() is creating a random number between 0 and 1, and then converting that number to a boolean. This is a lot of work for something that can be done in one line.

The reason this is faster than random.choice([0, 1]) is because random.choice() is creating a list of two items, and then choosing one of those items. This is a lot of work for something that can be done in one line.

The reason this is faster than random.randrange(2) is because random.randrange() is creating a random integer between 0 and 1, and then converting that integer to a boolean. This is a lot of work for something that can be done in one line.

The reason this is faster than math.floor(random.random()) is because math.floor() is taking a random number between 0 and 1, and then converting that number to an integer. This is a lot of work for something that can be done in one line.

The reason this is faster than int(random.random()) is because