mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-06-21 09:35:40 +02:00
wallpaper: compute weights directly
This commit is contained in:
parent
f09ba44366
commit
c414e90c28
1 changed files with 1 additions and 2 deletions
|
@ -218,8 +218,7 @@ def get_random_images(directory: str, number: int) -> list[Image]:
|
|||
except (OSError, ValueError):
|
||||
count = 0
|
||||
counts.append(count)
|
||||
counts = [(count - min(counts) + 1) ** 3 for count in counts]
|
||||
weights = [100 / count for count in counts]
|
||||
weights = [100 / ((count - min(counts) + 1) ** 3) for count in counts]
|
||||
images = [
|
||||
PIL.Image.open(image)
|
||||
for image in random.choices(image_files, k=number, weights=weights)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue