MiSTer_SAM
MiSTer_SAM copied to clipboard
Improve randomness
SAM seems to not be as random as we'd expect. While not definitive, there are runs of the same core or game several times in a row.
Look at ways to improve randomness. Consider keeping a list of recently played games and excluding the same titles from being selected again.
Suggestion is to use $RANDOM as a seed.
I changed shuf to use --random-source=/dev/urandom
. Not clear if this improved things though.
I have been playing around with this for arcade games. I delete the file from the tmp game list file after it is selected. That prevents it from being selected again until the list is empty.
mra="$(shuf --head-count=1 --random-source=/dev/urandom ${mralist})"
sed -i "/${mra}/d" ${mralist}
also once the list is empty I populate it again by calling build_mralist
This works for me. I am sure the gurus and implement this in a prettier way.
Thanks,
@mrchrisster, please look into this one. It would be nice if it could be done how spotify does with the shuffle feature. Aka it creates a list then once the list has been played then it creates a new shuffle list.
This is now implemented for non zip archives. SAM will play every game once before repopulating the list of games.
Cores now don't repeat twice in a row and big zip archives will now also not repeat. I feel like this justifies closing the issue.
I have seen one game show up at least 5 times today. It is the only thing in my TGFX16-CD folder. Does every core have an equal chance of being selected? If so, could there be a way to balance cores that have few games vs many games?
Thanks for your error reporting. I believe i have fixed the issue but working on some other changes as well.
The problem with balancing cores by games is that you might get a lot of SNES games and not a lot of other games because it has such a big library of games. What SAM does is never play the same core twice though
Personally, I'd prefer to see a lot of different games from the same core rather than the repeating games if cores have an equal chance of being selected (I think) and some cores have small libraries. Anyway, SAM is awesome and working quite well! Looking forward to following updates!