From 95440471c4f1d181c92b08fd18442b9eb5361d41 Mon Sep 17 00:00:00 2001 From: Wobbl Date: Tue, 16 Jul 2024 08:56:51 +0200 Subject: [PATCH] Made the random bool function faster. --- falling_sand.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/falling_sand.py b/falling_sand.py index 676e291..67af7c9 100755 --- a/falling_sand.py +++ b/falling_sand.py @@ -4,11 +4,11 @@ import pygame from pygame._sdl2 import Window from dataclasses import dataclass from wobbl_tools.data_file import load_dataclass_json, save_dataclass_json -from random import choice +from random import getrandbits def true_false_random(): - return choice([True, False]) + return getrandbits(1) == 0 @dataclass