wallpaper: put a bigger penalty for already seen wallpapers

This commit is contained in:
Vincent Bernat 2024-08-11 14:30:37 +02:00
parent b8301f188b
commit f09ba44366

View file

@ -218,8 +218,8 @@ def get_random_images(directory: str, number: int) -> list[Image]:
except (OSError, ValueError):
count = 0
counts.append(count)
counts = [count - min(counts) for count in counts]
weights = [100 / (count + 1) for count in counts]
counts = [(count - min(counts) + 1) ** 3 for count in counts]
weights = [100 / count for count in counts]
images = [
PIL.Image.open(image)
for image in random.choices(image_files, k=number, weights=weights)