Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Any way to deal with repeats? #840

Open
CamiloMM opened this issue Jan 22, 2025 · 3 comments
Open

Any way to deal with repeats? #840

CamiloMM opened this issue Jan 22, 2025 · 3 comments

Comments

@CamiloMM
Copy link

Say I have a wildcard of numbers 1 to 10. Then I get:

  • 4
  • 7
  • 4
  • 3
  • 4
  • 4

random_number

It's obvious I did not want this. On a large generation, I might generate a grid of 30 images with a wildcard with 50 entries; I don't need repeats, and I'll probably get 20. Or on a grid of 6, I don't want a repeat. I know this is how randomness works, but it's not what people expect.

Is there any way there could be an "avoid repeats" checkbox or a "max repeats" number input? Of course, it would not apply if you run out of entries, but still.

@ICodeDiffusion
Copy link

I agree it's really annoying, I don't want combinatorial feature but also don't want excessive repeats.

@eShep4
Copy link

eShep4 commented Feb 2, 2025

I've been having this problem using a HUGE list of wildcards - the same ~20 of them keeps showing up over and over again.

I did a little digging, and the trouble lays in the bias in pseudorandom number generation in the random.choice() method. This is compounded by the pseudorandom seed being reset to the image seed each time - so the first option on the pseudorandom table is used, which tends to be one of a few options.

This seems to happen in _get_random() in the randomprompt.py library. Way too rusty on my coding to formulate a solution, but I think not-setting the seed and reshuffling the list each image should make it more subjectively random.

@CamiloMM
Copy link
Author

CamiloMM commented Feb 6, 2025

That can't be right, can it? I assumed it was psychology messing with me. Even a crappy pseudo-random generator shouldn't have a bias that you would notice.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants