authorblues / bizhawk-shuffler-2

A script to randomly shuffle between games played in Bizhawk, with plugins to enhance the experience
MIT License
58 stars 21 forks source link

Not all games appear. #9

Closed nameless01234567 closed 3 years ago

nameless01234567 commented 3 years ago

I have a list with over a 100 games on the games folder, but only 30-40 of them show up. I have already set for shuffler to change very fast to make sure it wasn't just the randomness of the shuffler, but it changed almost 200 times over the same 30 games.

authorblues commented 3 years ago

Can you attach the .games-list.txt file that should have been generated in the games/ folder?

nameless01234567 commented 3 years ago

.games-list.txt Here it is. There is 148 games, not counting the .bin files.

authorblues commented 3 years ago

Yeah, I've confirmed this problem locally with large game lists. I will try to get this fixed asap, thanks!

nameless01234567 commented 3 years ago

No problem.

authorblues commented 3 years ago

I'm uncertain whether this fix is 100% correct, but the PRNG seed was looping with such a naive method, so I've added a small offset that seems to be fixing the problem. You're still subject to the coupon collector problem, so huge lists are still going to have games that don't show up for an absurdly long time.

To wit, for a list of 100 games, in expectation, it will take approx 660 (n log n) swaps for every game to have finally appeared at least once.

nameless01234567 commented 3 years ago

Yeah, but that's part of what I subjected myself to, I'm fine with that. The problem was only such a low amount of games appearing from such a large list, if 80-90 games have appeared and the rest doesn't show up, that's expected.

Edit: Can confirm it IS working for 148 games, as I left the shuffler running for a while and it created 148 save files.